Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Problem in receive a serial data and show it

Problem in receive a serial data and show it

2009-07-24 by aligole_2005

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?

Re: Problem in receive a serial data and show it

2009-07-25 by aligole_2005

Dear Catalin
I don't think so, because if you mean these : 
char status,data;
they are some codes that the code vision make them itself, when we active the usart.




--- In AVR-Chat@yahoogroups.com, Cat C <catalin_cluj@...> wrote:
Show quoted textHide quoted text
>
> 
> Could it be that you update some variable in an ISR routine and it's not declared as "volatile" ?
> 
> Good luck,
> 
> Cat
> 
> > To: AVR-Chat@yahoogroups.com
> > From: aligole_2005@...
> > Date: Fri, 24 Jul 2009 21:20:07 +0000
> > Subject: [AVR-Chat] Problem in receive a serial data and show it
> > 
> > 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? 
> > 
> > 
> > 
> > 
> > ------------------------------------
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> 
> 
> [Non-text portions of this message have been removed]
>

RE: [AVR-Chat] Problem in receive a serial data and show it

2009-07-25 by Cat C

Could it be that you update some variable in an ISR routine and it's not declared as "volatile" ?

Good luck,

Cat

> To: AVR-Chat@yahoogroups.com
> From: aligole_2005@yahoo.com
> Date: Fri, 24 Jul 2009 21:20:07 +0000
> Subject: [AVR-Chat] Problem in receive a serial data and show it
> 
> 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? 
> 
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
> 


[Non-text portions of this message have been removed]

Re: [AVR-Chat] Re: Problem in receive a serial data and show it

2009-07-25 by Jim Wagner

If it is CodeVision, then some other mechanism is probably involved.  
gcc uses "volatile".

Sounds like it is time to read!

Jim

On Jul 25, 2009, at 11:51 AM, aligole_2005 wrote:

> Dear Catalin
> I don't think so, because if you mean these :
> char status,data;
> they are some codes that the code vision make them itself, when we  
> active the usart.
>
> --- In AVR-Chat@yahoogroups.com, Cat C <catalin_cluj@...> wrote:
> >
> >
> > Could it be that you update some variable in an ISR routine and  
> it's not declared as "volatile" ?
> >
> > Good luck,
> >
> > Cat
> >
> > > To: AVR-Chat@yahoogroups.com
> > > From: aligole_2005@...
> > > Date: Fri, 24 Jul 2009 21:20:07 +0000
> > > Subject: [AVR-Chat] Problem in receive a serial data and show it
> > >
> > > 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?
> > >
> > >
> > >
> > >
> > > ------------------------------------
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
> 



[Non-text portions of this message have been removed]

Re: Problem in receive a serial data and show it

2009-07-26 by s.holder123@btinternet.com

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:
Show quoted textHide quoted text
>
> 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?
>

Re: Problem in receive a serial data and show it

2009-07-27 by aligole_2005

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:
Show quoted textHide quoted text
>
> 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?
> >
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.