Single command byte RS232 simulation

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

Moderators: Benj, Mods

Post Reply
User avatar
tmd_63
Flowcode V4 User
Posts: 21
Joined: Sat Dec 26, 2009 9:47 pm
Location: Swindon, England
Has thanked: 9 times
Been thanked: 1 time
Contact:

Single command byte RS232 simulation

Post by tmd_63 »

I am trying to use flowcode pro v4.
I want to input a command byte into a PIC16F887 using the EUSART. The command byte would have each bit set or cleared for a particular command, ie 00000001 to instruct an LED on etc. But I am unable to simulate this using the RS232 component as this only allows an ASCII charater input and codes below ASCII(10) are commands rather than actual characters.
Is there any way of inputting a binary code via the RS232 component as would be generated via a computer program using this command byte format. Note, two of the bits in the command byte would also require the transmission of an ascii string for outputting onto the lcd component.

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

Re: Single command byte RS232 simulation

Post by Steve »

Set the simulation to be "bytes" rather than "characters". Then, you will be able to "inject" raw ascii values rather than just displayable characters using the "+" button on the simulation.

User avatar
tmd_63
Flowcode V4 User
Posts: 21
Joined: Sat Dec 26, 2009 9:47 pm
Location: Swindon, England
Has thanked: 9 times
Been thanked: 1 time
Contact:

Re: Single command byte RS232 simulation

Post by tmd_63 »

Thank you Steve, I will try that.
I have just set up the intterupt to operate the RS232 recieve but I am now having trouble getting the simulation to register the input from the RS232.
Is there anything else special that I need to set compared to the code stated in the help files for RS232 USART interupts for the PIC?

User avatar
tmd_63
Flowcode V4 User
Posts: 21
Joined: Sat Dec 26, 2009 9:47 pm
Location: Swindon, England
Has thanked: 9 times
Been thanked: 1 time
Contact:

Re: Single command byte RS232 simulation

Post by tmd_63 »

I am still having trouble simulating the RS232 input.
Can anyone help?
Attachments
Flowcode1.fcf
(22.42 KiB) Downloaded 560 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: Single command byte RS232 simulation

Post by Benj »

Hello

I see the problem. It is due to the fact that you are using the RXINT interrupt and then collecting the RS232 byte inside an interrupt routine. This is correct for hardware however Flowcode cannot currently simulate this interrupt. I will add it to the bugs list.

User avatar
tmd_63
Flowcode V4 User
Posts: 21
Joined: Sat Dec 26, 2009 9:47 pm
Location: Swindon, England
Has thanked: 9 times
Been thanked: 1 time
Contact:

Re: Single command byte RS232 simulation

Post by tmd_63 »

Thank you. Apart from the dual use of the RS232 tranmission interrupt, which I will have to address.
Can you see any other major problems with my code.
This is the first time of using your program, which appears to be a very useful tool. And I would like to use it a lot more on quick dev projects.
I know this is a little off topic, but is it possible to have a weigand component made that works in a similar way to the RS232 component.

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: Single command byte RS232 simulation

Post by Benj »

Hello

From looking at your code it looks like it should be ok though I have not tested it on actual hardware.

A weigand component is possible by tailoring your own custom component though this does require a knowledge of C code. You should be able to use the code custimization features of V4 to alter the custom component from the original. Alternativly you can edit the custom component C code file manually.

If the weigand component uses the RS232 connection then you can create this in Flowcode and then use the custom component code to call the C functions for the RS232.

Post Reply