Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to read character in Rx Buffer ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Activity points
9,442
Guys,

I'm using UART for reading RFID card on Cypress PSoC, and I want to read a character received on Rx buffer, anyone has experience with it ?
Any ideas will be appreciated,
I can read some characters already but not yet a valid character,

thanks
Code :
Code:
//Search card begin, return 0x01 if card is present
	   do {

             UART_1_CmdReset();				// Reset Command Buffer
		
			   for (i=0;i<15;i++)	
				{
					UART_1_PutChar(0x01); // Send a character to UART TX port 
				}
				  Delay50uTimes(1);
				c = UART_1_cGetChar();
		 }while (c == 0);
     //Search card end, return 0x01 if card is present       
		 				
		if (c == 0x01)//check the card available
		{
		 LCD_clr_line(0);
		 LCD_clr_line(1);
		 LCD_1_Position(0,0);
		 LCD_1_PrCString("Card in ");

		 UART_1_CmdReset();				// Reset Command Buffer
		 //send AB 02 01 until get a valid response begin
		do {    
		   for (i=0;i<3;i++)	
				{
					UART_1_PutChar(sel_card[i]); // Send a character to UART TX port 
				}
		Delay50uTimes(1);
		//Waits for a valid character in UART RX and returns its value.
		byte_length = UART_1_cGetChar();
		
		 }while (byte_length == 0);		
		 //send AB 02 01 until get a valid response end		
				      
					  //Returns length of characters in the command buffer. This command returns the current command
					  //length, whether a command terminator has been received or not.
					  byte_length = UART_1_bCmdLength();
					 
                             LCD_1_PrHexByte(byte_length);
				 
                   for (i=0;i<byte_length;i++)
						{
							RxdataBuff[i] = UART_1_cGetChar();	// Get a character from UART RX data register 
                   		}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top