Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "project.h"
- #include "stdio.h"
- #define TRUE 1
- #define FALSE 0
- char TransmitBufferUSB[16];
- int16 rx_data = 0;
- uint16 rx_udata = 0;
- CY_ISR(UART_ISR){
- ISR_Rx_Disable(); //Make sure i can't be interrupted while i'm interrupting.
- Status_pin_Write(0xFF); //Used for debugging
- uint8 rx_msb = UART_GetByte();
- uint8 rx_lsb = UART_GetByte();
- rx_udata = ((uint16)rx_msb << 8) | rx_lsb;
- sprintf(TransmitBufferUSB,"%d\n\r",rx_udata);
- UART_USB_PutString(TransmitBufferUSB);
- Status_pin_Write(0x00);
- ISR_Rx_Enable();
- }
- int main(void)
- {
- CyGlobalIntEnable; /* Enable global interrupts. */
- UART_USB_Start();
- UART_Start();
- ISR_Rx_StartEx(UART_ISR);
- while(1){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement