Yahoo Groups archive

AVR-Chat

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

Message

Re: Serial format

2005-03-14 by brewski922

--- In AVR-Chat@yahoogroups.com, "fjch100" <fjch100@c...> wrote:
> 
> HI,
> I have a question:
> when I sent a Long(4 bytes) variable from the PC to the AVR which 
> byte is first? LSB ? MSB ?
> and if a need to sent a Long from the AVR to the PC USART (with a 
> Borland Delphi program) what byte is needed to be first? LSB ? MSB?
> 
> also I´m using WINAVR GCC, my LCD rutine is with printf, how can I 
> set the GCC to use LCD & USART simutaneusly with printf/fdevopen ?

That depends on the protocol. If you are sending a file you are 
sending binary info. I know nothing about how programs do that but I 
have written programs that an AVR sends command "B0102\r" consisting 
of 5 ASCII characters followed CR, another ASCII.

The equipment that receives this command is a Audio/Video switcher. 
The switcher is expecting the command to consist of 
A=Audio V=Video B=Both
Outport port, there are 2, 01 and 02
Input port, there are 8, 01 through 08
Carriage Return

In the above I'm switching Both, to Output 1, from Input 2.

I'm using CodeVision and the above string is stored in Flash as
flash char    S12[]="B0102\r";
When the appropriate pushbutton is pushed the above string is sent 
out the serial port. The fact that the switcher changes correctly as 
commanded proves that that string arrives at the switcher exactly as 
it is stored in Flash with the exception that the '\r' is replaced 
with a CR.

The fact that you are sending bytes may be the problem. 

Could you show us a snippet of your code?

Mike

Attachments

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.