RS232 Project Not Working
Moderator: Benj
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
RS232 Project Not Working
Hi,
I am basically trying to learn how RS232 works and so I am trying to send a serial command to my 4D display, the chart is supposed to send values of 60 and 40 to the Meter which has an index of 0. When I program the chip it does not do anything but if I program it using the Visi component then it works fine, I have noticed that when using the Visi Console there is an extra command of 0xff on there but I don't know what this is, could somebody give me a pointer please...
cheers
Acestu
I am basically trying to learn how RS232 works and so I am trying to send a serial command to my 4D display, the chart is supposed to send values of 60 and 40 to the Meter which has an index of 0. When I program the chip it does not do anything but if I program it using the Visi component then it works fine, I have noticed that when using the Visi Console there is an extra command of 0xff on there but I don't know what this is, could somebody give me a pointer please...
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- 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 Project Not Working
Hi Stu,
You will need a second delay after the second RS232 command or you will probably only ever see the first state.
Other then that everything looks ok, check sums etc.
You will need a second delay after the second RS232 command or you will probably only ever see the first state.
Other then that everything looks ok, check sums etc.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Benj,
Is the delay between the commands a standard period or is it trial and error ?
thanks
Acestu
Is the delay between the commands a standard period or is it trial and error ?
thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- 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 Project Not Working
Hi Stu,
You should just need long enough delay to be able to see the second state before the first state kicks in again.
One thing I missed is that after every command you send out you need to attempt to receive a byte with a fairly big timeout, if the command was accepted then the return value will be equal to 6. It is this waiting for a response that ensured you don't send out commands too quickly.
Another thing I missed is that you are passing the values inside a string which will not work as the bytes sent out will be '0','x','0','1', etc.
Here is an example that should work.
You should just need long enough delay to be able to see the second state before the first state kicks in again.
One thing I missed is that after every command you send out you need to attempt to receive a byte with a fairly big timeout, if the command was accepted then the return value will be equal to 6. It is this waiting for a response that ensured you don't send out commands too quickly.
Another thing I missed is that you are passing the values inside a string which will not work as the bytes sent out will be '0','x','0','1', etc.
Here is an example that should work.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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 Project Not Working
Edit,
I missed the RS232 initialise from the very start of the program. You will need to add this for it to work
I missed the RS232 initialise from the very start of the program. You will need to add this for it to work

Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 155
- Joined: Thu Feb 10, 2011 4:39 am
- Location: Las Vegas, Nevada USA
- Has thanked: 40 times
- Been thanked: 19 times
Re: RS232 Project Not Working
Hi Benj
In your example above you use variables which are do not seem to have been defined, such as .command, .MSB, .in.. I don't understand what is happening here. Would you please explain or point me to somewhere that would help me to understand what is going on here. Thank you.
Larry
In your example above you use variables which are do not seem to have been defined, such as .command, .MSB, .in.. I don't understand what is happening here. Would you please explain or point me to somewhere that would help me to understand what is going on here. Thank you.
Larry
- 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 Project Not Working
Hi Larry,
Those local variables are parameters of the macro which are passed in from the calls in the main macro. If you double click on the start icon for the SendCommand macro you can see the parameters being specified. The macros tab of the project explorer is another good place to look as it allows you to display this type of information for all macros.
Those local variables are parameters of the macro which are passed in from the calls in the main macro. If you double click on the start icon for the SendCommand macro you can see the parameters being specified. The macros tab of the project explorer is another good place to look as it allows you to display this type of information for all macros.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 155
- Joined: Thu Feb 10, 2011 4:39 am
- Location: Las Vegas, Nevada USA
- Has thanked: 40 times
- Been thanked: 19 times
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Benj,
Does the RS232 Initialise macro have to go right at the start of the chart or start of the loop, I have placed it at the beginning but the chart does not want to work in hardware, I will try a few different things anyway...
cheers
Acestu
Does the RS232 Initialise macro have to go right at the start of the chart or start of the loop, I have placed it at the beginning but the chart does not want to work in hardware, I will try a few different things anyway...
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Benj,
I have tried putting the initialize command in a few different places but I can't get it to work. I am enclosing a pic of the console when in simulation.
cheers
Acestu
I have tried putting the initialize command in a few different places but I can't get it to work. I am enclosing a pic of the console when in simulation.
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Benj,
I have written a chart using the Visi component and the meter works fine, so there is nothing wrong with the meter.
thanks
Acestu
I have written a chart using the Visi component and the meter works fine, so there is nothing wrong with the meter.
thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- 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 Project Not Working
Hi Stu,
Is it the RS232 initialise your having problems with?
Here is an updated version of the last file with the addition of the init function.
Is it the RS232 initialise your having problems with?
Here is an updated version of the last file with the addition of the init function.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Benj,
Thanks for the new chart, I will have a look as soon as I get home later.
cheers
Acestu
Thanks for the new chart, I will have a look as soon as I get home later.
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Benj,
I have tried to program the chip about 20 times with the new chart but every time I get the Error code 118
cheers
Acestu
EDIT I have also tried medelec's suggestion of reloading the file but no difference
I have tried to program the chip about 20 times with the new chart but every time I get the Error code 118
cheers
Acestu
EDIT I have also tried medelec's suggestion of reloading the file but no difference
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi,
I was just about to try a different compiler when I clicked the wrong thing ie compile to chip, and it worked, however the chart still does not work Benj, so I don't really know whats going on as the visi component works fine, but when I program with this chart it doesn't want to know.
cheers
Acestu
I was just about to try a different compiler when I clicked the wrong thing ie compile to chip, and it worked, however the chart still does not work Benj, so I don't really know whats going on as the visi component works fine, but when I program with this chart it doesn't want to know.
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi,
I have been trying to compare and workout what is going on in the console window, now with the visi component I can see the Hex values that are being sent and I think in the red brackets is what is sent back ie ff 255.
When I look at the RS232 console I just see a lot of gobbledygook is this right if so what does it mean ?
I am enclosing pics of both so you can see what I mean.
cheers
Acestu
EDIT:
With the display connected in simulation I can see that the display returns 6 (Red Brackets)
I have been trying to compare and workout what is going on in the console window, now with the visi component I can see the Hex values that are being sent and I think in the red brackets is what is sent back ie ff 255.
When I look at the RS232 console I just see a lot of gobbledygook is this right if so what does it mean ?
I am enclosing pics of both so you can see what I mean.
cheers
Acestu
EDIT:
With the display connected in simulation I can see that the display returns 6 (Red Brackets)
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi,
I have had a look in the Flowcode 6 help but I can't find anything that might explain the letters/symbols/numbers in the RS232 console window, if anybody can explain or has a link I would be grateful.
cheers
Acestu
I have had a look in the Flowcode 6 help but I can't find anything that might explain the letters/symbols/numbers in the RS232 console window, if anybody can explain or has a link I would be grateful.
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- JonnyW
- Posts: 1230
- Joined: Fri Oct 29, 2010 9:13 am
- Location: Matrix Multimedia Ltd
- Has thanked: 63 times
- Been thanked: 290 times
- Contact:
Re: RS232 Project Not Working
Hi.
The numbers on the console [01][10]<-[01][10](9 are, in hex, 0x01, 0x10, 0x3C, 0x2D, 0x1, 0x10, 0x28, 0x39. This repeats over and over again.
With the exception of the 0x00 characters in the packeted image above, these are the same values as in this image. There is a console mode where you can see the bytes as well as the text that comes down the console (the EEPROM component uses this). This is an option set via the API, but I might add it in as an option in a menu too so you can see what the values are in 'raw bytes' as opposed to ASCII if you wish.
Cheers,
Jonny
The numbers on the console [01][10]<-[01][10](9 are, in hex, 0x01, 0x10, 0x3C, 0x2D, 0x1, 0x10, 0x28, 0x39. This repeats over and over again.
With the exception of the 0x00 characters in the packeted image above, these are the same values as in this image. There is a console mode where you can see the bytes as well as the text that comes down the console (the EEPROM component uses this). This is an option set via the API, but I might add it in as an option in a menu too so you can see what the values are in 'raw bytes' as opposed to ASCII if you wish.
Cheers,
Jonny
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Jonny,
Thanks for the info,
Sorry for sounding thick but how can I find out what each of these symbols mean ?
ie What does the < and the - mean? or the ( or the 9 ?
also that sounds like a top addition, I am just trying to work out why Benj's chart will not work, if anybody has any pointers please let me know.
cheers
Acestu
Thanks for the info,
Sorry for sounding thick but how can I find out what each of these symbols mean ?
ie What does the < and the - mean? or the ( or the 9 ?
also that sounds like a top addition, I am just trying to work out why Benj's chart will not work, if anybody has any pointers please let me know.
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Jonny,
I realize now that the symbols are ASCii symbols, but the chart still doesn't work
cheers
Acestu
I realize now that the symbols are ASCii symbols, but the chart still doesn't work

cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
Re: RS232 Project Not Working
Hi Benj
If you can could you check the chart that you did for me please, I cannot get it to work on Flowcode 6 for some reason..
thanks
Acestu
If you can could you check the chart that you did for me please, I cannot get it to work on Flowcode 6 for some reason..

thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.