- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day
I've been trying to recieve data from pc hyperterminal but I don't understand how can I recieve more than one character
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jdbatista,
you should show your code.
In general, it's checking how many bytes are in the receive buffer, using this value as a loop counter and then reading out byte by byte until the loop has finished.
Regards,
Ralf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since the UART sends and receives one byte at a time you have to retrieve your received message character by character. Depending on the way you use your UART there are different indicators for checking if a character is already received, in your buffer or in the FIFO. Have a deep look into the datasheet.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is an example project essentially doing this, character for character.
Goto "File", "Example Project" -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Note that the -030 DevKit already has a level translator on board (see part 4.2.8 in the user guide).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The -001 kit also has a RS232 transceiver.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well thanks for your answers, but recieving one character I understand until now, but at the time i wanna storage tha character follow by another characther is where I don't have idea how.
Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you post your complete project here we all can have a look at and see where your problems are.
Use "Creator -> File -> Create Workspace Bundle (minimal)" and then attach the resulting file with your next reply (DO NOT use chrome, that does not work).
BTW: Are you using a development kit? Which one ??
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The you would create a char array, a pointer into it, and as each char is received
its deposited into array and the pointer incremente to get ready for next char. When you
get to end of array reset ptr to beginning, this creates a circular buffer. If you are sending
a line terminated message, include code to deted EOL and act on it when it occurs.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm really new with psoc so I have no reference about the pointer and array, do u have an example that I could use to understand hot to create the array and the pointer?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has nothing to do with PSoC, it is just C
#define NumberOfValues 2048
int16 ADCData[NumberOfValues];
int16 * ADCPointer;
// ...and later
ADCPointer = ADCData; // or
ADCPointer = &ADCData[0]
// You may write
ADCData[122] = 32767;
*ADCPointer[122] = 32767;
*(ADCPointer + 122) = 32767;
Here is a link to my favorite C-Manual publications.gbdirect.co.uk/c_book/
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
MytRxData[ 21 ] = " "; // This clears array and its terminated by null character in 20'th position.
// Remember this array address goes from 0 - 19, 20 is nul end of string terminator
unit8 pTr = 0; // We will use this as array pointer
.char CharRecv = 0;
.
.
for ( ;; ) {
CharRecv = UARgetdata (whatever name of function is( );
MyRxData[ pTr ] CharRecv;
pTr = ( pTr == 19 ) ? 0 : pTr + 1; // Test for end of array, reset to 0 if it is
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Dana for your explanation, I really understand now how to point to an array
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A couple of typo's in code, fixed here -
MytRxData[ 21 ] = " "; // This clears array and its terminated by null character in 20'th position.
// Remember this array address goes from 0 - 19, 20 is nul end of string terminator
unit8 pTr = 0; // We will use this as array pointer
char CharRecv = 0;
.
.
for ( ;; ) {
CharRecv = UARgetdata (whatever name of function is( );
MyRxData[ pTr ] = CharRecv;
pTr = ( pTr == 19 ) ? 0 : pTr + 1; // Test for end of array, reset to 0 if it is
}
And attached a treatise on pointers.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks dana for the file,