CMPE1250 – LAB #1: SCI Tx and Rx RTI based events

Java Python CMPE1250 – LAB #1: SCI Tx and Rx, RTI based events.

The purpose of this LAB is to be able to configure different time settings based on the RTI.

Those settings could be changed through button presses as well as through input received from the terminal. We will also send feedback to the terminalso the user can interact with the firmware running on the board.

PART A

Create an RTI non-blocking event to toggle the RED LED every 50[ms]. Given the fact that the RTI provides you with an accurate 1[ms] tick, this should be a simple task to accomplish. Verify this functionality using an oscilloscope or AD2.

PART B

We will now allow this toggle event to be adjusted to settings between 10[ms] and 100[ms], inclusive. Add functionality such that when the UP switch is pressed, the RED LED toggle

event will increase the time in multiples of 10[ms] up to a maximum of 100[ms]. Pressing   the DOWN switch will decrease the RED LED toggle event in multiples of 10[ms] down to a minimum of 10[ms]. Verify this functionality using an oscilloscope or AD2.

PART C

Up to this point you have been sending ascii characters to the terminal as well as receiving them from it. Including the stdio.h library will allow you to, for instance, send a number formatted as text using sprintf. The other capability is to receive text from the terminal and parse it to a number, if possible, using sscanf. The sscanf f CMPE1250 – LAB #1: SCI Tx and Rx, RTI based events unction will return 1 if the text was able to be parsed into a number using the format specifier (%d, %f, etc.), otherwise it will return 0. This could help you handle the wrong input.

We would now like to set the toggle event time to any number between 10 and 100 inclusive, having a resolution of 1[ms] this time, as opposed to the 10[ms] in Part B. This will be accomplished adding the following functionality:

-     Accept input from the terminal and process it once the user presses the ENTER key (CR).

-     If the input cannot be parsed into a number of the format specifierselected, send the following message to the sci: “Input in the wrong format”.

-     If the input can be parsed into a number, but it is less than 10, or greater than 100, send the following message to the sci: "Wrong setting, number must be between 10 and 100 inclusive”.

-     If the number meets the requirements for a proper toggle event as defined, adjust the RED LED toggle time in [ms] to be set to the value entered. At this point, send the following message to the sci: “RTI event set to xx[ms]”, where xx is the number of milliseconds the time event was updated to. Verify this functionality using an oscilloscope or AD2. Make sure to add “\r\n” at the end of each message sent to the sci so they can be display in a single line.

Remarks

•    Please note that if you send a number from the sci to set the time to anon-multiple of

10, the button presses should still work after with increments and decrements by 10, but the time should never exceed 100[ms] or be less than 10[ms].

•    Once you have completed Part C, you could add the feedback message: “ RTI event set to xx[ms]” to also be sent to the sci when the UP or DOWN switches are pressed         

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值