Page 1 of 1

RS232 Newbie Question

Posted: Fri Sep 20, 2013 9:29 am
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 :-) !

Re: RS232 Newbie Question

Posted: Fri Sep 20, 2013 2:43 pm
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.

Re: RS232 Newbie Question

Posted: Fri Sep 20, 2013 3:38 pm
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

Re: RS232 Newbie Question

Posted: Fri Sep 20, 2013 4:37 pm
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

Re: RS232 Newbie Question

Posted: Mon Oct 28, 2013 1:40 am
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.

Re: RS232 Newbie Question

Posted: Mon Oct 28, 2013 1:42 am
by ayush
also i am unable to post my queries please please help :roll:

Re: RS232 Newbie Question

Posted: Mon Oct 28, 2013 4:54 pm
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.