RS232 Newbie Question

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Puput
Posts: 2
Joined: Fri Sep 20, 2013 6:22 am
Contact:

RS232 Newbie Question

Post by Puput »

Hi,

I'm very new to Flowcode so forgive me if this a silly question but I have searched Google and these forums without finding anything that answers my question.

I have little experience of Pics etc but I own Flowcode V6 Pro + some E-blocks and am able to follow and get examples working.

However I have a real world project I want to get started on and have hit a brick wall right at the start.

I want to interface a PIC to this (im trying with 16F877A at the moment but I can use anything):

https://www.atlas-scientific.com/_files ... it_3.0.pdf

However I cannot get flow code to work with it. It requires the RS232 to be 38400 8N1 and append the data string with <CR> only

I cannot seem to make this happen in Flowcode easily, am I being a bit dim?......

I have been able to get the Atlas circuit running on the Arduino demo code so have confirmed the Atlas module works ok, but I need it to work with the EB006 for my project.

Thanks for any pointers you can offer but please assume I know very little when responding :-) !

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: RS232 Newbie Question

Post by Benj »

Hello,

You could either send as bytes so here is a command from the sensor command table. The single quotes are used to pass the binary value of the character.

Send Byte 'P'
Send Byte ','
Send Byte '\r'

Or you could send as a string.

Send String "P,\r"

\r is a standard escape character used to generate the ascii value for a carriage return.

Puput
Posts: 2
Joined: Fri Sep 20, 2013 6:22 am
Contact:

Re: RS232 Newbie Question

Post by Puput »

Thanks Benj thats a great help but how do I set Parity and Stop Bits etc..... I can see that I can change Baud, Data Length and Flow but not the parity, start and stop bits?

Thanks

Paul

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: RS232 Newbie Question

Post by Benj »

Hi Paul,

Parity is off by default and the number of start and stop bits is set to 1.

If you need to output parity then you will need to set the data bits to 9 and calculate the extra bit yourself using software before sending the value.

If you need multiple stop bits then just insert a delay after every send macro to ensure enough time is inserted between each send.

Min Delay = (1 / Baud) * NumberOfRequiredBitsPerPacket

ayush
Posts: 4
Joined: Mon Oct 28, 2013 1:11 am
Has thanked: 4 times
Contact:

Re: RS232 Newbie Question

Post by ayush »

Hello all,

I am a new bee in embedded coding,i am in XII standard .I had started using flow code for coding ,but i am unable to run the program in proteus simulator.
The program runs well in flowcode and behave accordingly.Please help.
Attachments
Flowcode1.fcf
(11 KiB) Downloaded 240 times

ayush
Posts: 4
Joined: Mon Oct 28, 2013 1:11 am
Has thanked: 4 times
Contact:

Re: RS232 Newbie Question

Post by ayush »

also i am unable to post my queries please please help :roll:

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: RS232 Newbie Question

Post by Benj »

Hello,

In your program you only have 1 delay, to be able to see the output toggling you will need another delay after you switch the LED off.

Also a delay of 1 microsecond is not going to be visible. While your trying to get this up and running why not switch the delays to 1 second to make things easier.

You have the target device set to be a Microchip FS USB device which will likely not simulate correctly in Proteus as Proteus will be missing the bootloader that the actual hardware will be using. What about using a 16F877A or 16F88 as these should be much easier for a beginner to get running. If you have to use this device then switch to the standard 18F4550 device and setup the configuration to match the settings in Proteus. The device datasheet will detail each of the configuration settings.

If you need to sign up for the v4 or v5 forums then you can do so by following one of the links in my signature.

Post Reply