I mean, for example when I use "%S" it shows some strange figures in GLCD, or when I use "%U" it shows some wrong numbers in GLCD (because the numbers should formally be in a range and don't change very much). The structure of packet exist in the second file that I shared. It's 5 byte, 4800 baud rate, 1 stop bit, odd parity. And in eny second we receive 60 packet. And I should say that we don't receive the deta from pc, It's a data from a module. Unfortunately, as you can see in the second shared file, the datasheet doesn't mentioned about the format of the bytes. I thought they must be numbers. The problem is showing a string's character with a function that accept a pointer to the first of string. --- In AVR-Chat@yahoogroups.com, "s.holder123@..." <s.holder123@...> wrote: > > When you say wrong, what do mean ? > > When you send your data from the pc how is the data formatted ie are they ascii characters '0','1','2' etc or number values 1,2,3,4 interpretation between these values would be different especially when you send them as a string. > > What is a typical data packet for your code ? > > Echo back what you receive see if it corresponds with what you transmit. > > As a note when sending data in this type of format it may be an idea to structure the data in a formal packet start of data header, length of data, end of data and maybe a simple crc, this way you can always validate what you receive, it may seem excessive for these small packets but it is scaleable for larger more complex data sets. > > Regards > > --- In AVR-Chat@yahoogroups.com, "aligole_2005" <aligole_2005@> wrote: > > > > Hello > > I'm doing my final project of university. In a part of this I need to receive a serial data with special structure that I shared it here : > > > > http://www.4shared.com/file/120420235/3829d17a/Usart.html > > > > It's briefly a 5 byte formatted data, that every single byte has a meaning for example some of them are numbers, that I wanna show them in a graphic LCD. > > > > I've written a program in Code vision and I share it here because I think it would be good for you, my friends. > > > > http://www.4shared.com/file/119286132/69e1cd0/testc.html > > > > This program consists of two different part, the first is about GLCD functions that I properly can show everything on it, from pictures (bitmaps) to numbers and strings with different functions. > > The second part is about the serial data getting and processing. My question is about the final part, when I want to show the received and registered serial data on GLCD, I can't do this properly, actually my numbers are not true!!! > > > > the registered data is in the shape of a string with the length of 5, that I defined some macros for them. My GLCD function "lcd_put_strs(x,y, *str)" can show a string in SRAM in GLCD. but when I use it, the answer is not true!!! I tried "%u" or "%X" or "%S", but unfortunately the result was wrong. > > can anybody help me plzzzzzzzzz? > > >
Message
Re: Problem in receive a serial data and show it
2009-07-27 by aligole_2005
Attachments
- No local attachments were found for this message.