RS-232 AVR exampels

Forum for problems or queries regarding Flowcode Comms Components. Eg LIN, I2C, SPI, RS232, CAN, IrDA etc

Moderators: Benj, Mods

Post Reply
Jan S.
Posts: 7
Joined: Thu Oct 02, 2008 7:13 am
Contact:

RS-232 AVR exampels

Post by Jan S. »

Hello at All,

iΒ΄ve problems to cumunicate between an ATmega16 and my PC.
So IΒ΄m searching for an exampel of the RS-232 comunication, witch is programmed in AVR.
Becaus IΒ΄ve the original AVR-version of Flowcode, I canΒ΄t open the Pic versions.

Thanks for helping

best regards
Jan

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: RS-232 AVR exampels

Post by Steve »

You can open the PIC versions by selecting "File..import" in the menu of Flowcode.

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times
Contact:

RS-485 ??

Post by tech »

Hi,

The Flowcode V4, will it have the support of RS485 ????

Thank you

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: RS-232 AVR exampels

Post by Steve »

no.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RS-232 AVR exampels

Post by Benj »

Hello

Flowcode is already compatible with RS485.

RS485 is basically just a name for the voltage shifting and manipulation that is done to the serial bus. RS232 is acheived by attaching our RS232 E-Block or a MAX232 chip to the hardware UART pins of the chip to shift the voltages from GND and 5V to +12V and -12V. Similarily RS485 can be acheived by attaching a MAX485 to the pins of the UART.

The max chip is only half duplex so you will have to use some digital I/O pins to control the data direction. I am also told that full duplex RS485 chips are available so if you are using these then you will not have to do this.

In RS485 the 9th data bit can be enabled to allow the receiver to determine the difference between data and addresses. The current RS232 component in Flowcode will not let you do this but you should be able to edit the component driver code to allow this functionality.

Hope this helps.

Jan S.
Posts: 7
Joined: Thu Oct 02, 2008 7:13 am
Contact:

Re: RS-232 AVR exampels

Post by Jan S. »

Hello, itΒ΄s me again :)

I'am writig a Programm to communicate with the PC via RS232, but in my programm is allready a bug.
IΒ΄ve tryed a lot, but I canΒ΄t clear these faults out of my programm.

So I would like to try it here, if some of you experts can help me.

You can find the flowchart in the attachment.


Here a short description of the programm:

I'am useing a ATmega 16 ΒµC
The Pins PA0 and PA1 should have the function of a ADC (10Bit)
The ΒµC should give these values per RS232 to the PC.
The PC sends an value, witch the ΒµC converts to a 16Bit signal. After that, the ΒµC gives the 16Bit out at the Ports B (high Bits) and C (low Bits). On these Ports is a 16Bit DAC connected.
The whole shematic has a function of a closed-loop control.

I hope, that someone can halp me.

Thank you
Attachments
flowchart.fcf_avr
(5.5 KiB) Downloaded 416 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RS-232 AVR exampels

Post by Benj »

Hello

After your RS232 read you will need a decision with the following paremeter.

IN < 255

Then if this decision is true then write the received byte to Port B.

Your current program is overwriting the LEDs with every iteration of the loop and therefore is probably going to fast for you to be able to see the LED values changing.

Post Reply