RS232 serial communication not working

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Contact:

RS232 serial communication not working

Post by imtiaz9 »

I want to communicate 18f452 device to PC through RS232 and try to display a byte number on hyperterminal. But only different symbols are display when i pressed any key on 18f452. Any idea to solve it
Attachments
SDR.jpg
SDR.jpg (44.45 KiB) Viewed 2266 times
452.fcf
(19 KiB) Downloaded 82 times

User avatar
Benj
Matrix Staff
Posts: 14832
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: RS232 serial communication not working

Post by Benj »

Hello,

You are simply printing the TOTAL variable as a byte if you look at the ASCII table then you can see that the values 0-255 will generate lots of different characters.

http://www.asciitable.com/

If you instead convert total to a string and then print the string then this will print the number as an ASCII set of digits representing the value of the number.

str = ToString$(TOTAL)

If you only want to print a single digit 0-9 then you can change the SendRS232Char parameter from TOTAL to TOTAL + '0'. This shifts the value up by the ASCII value for 0, again refer to the ASCII table link for info. You will also need to bounds check the TOTAL value so when incrementing and decrementing the value it cannot go lower than 0 or higher than 9.

Hope this helps.

imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Contact:

Re: RS232 serial communication not working

Post by imtiaz9 »

thanks benj. its solved...

Post Reply