Can V6 simulate RXINT?

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

Moderator: Benj

Post Reply
beejo
Posts: 31
Joined: Thu Sep 11, 2008 12:46 pm
Location: TheNetherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Can V6 simulate RXINT?

Post by beejo »

Hi,
Can i monitor the RS232bus using the RXINT interrupt with Flowcode V6?

Beejo

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: Can V6 simulate RXINT?

Post by Benj »

Hello Beejo,
Can i monitor the RS232bus using the RXINT interrupt with Flowcode V6?
In hardware the RXINT interrupt should work when a byte is received on the UART.

In simulation the RXINT will likely do nothing at the moment. I can probably provide a nice workaround if you want to be able to simulate the incoming interrupt.

beejo
Posts: 31
Joined: Thu Sep 11, 2008 12:46 pm
Location: TheNetherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Can V6 simulate RXINT?

Post by beejo »

Hi Benj,
Thank you.
Yes i can use the nice work around because i have still a lot of problems to build a rs232 communication on a pic (eg pic16F877A) between a controller and a rs232 device.
I am trying to make one connection on port C to the controller and one connection on port B to the device Using RXINT for reading Port C and interrupt "Port" to read data from the device.
To accomplish that i use 2 RS232 boards E015.
I hope you can help me.
Thank in advance,
Beejo

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: Can V6 simulate RXINT?

Post by Benj »

Hi Beejo,

Are both your devices 16F877A? If so then the RXINT will only work for the hardware UART channel on portc 6 and 7. Software receive interrupt can be done using a INT or IOC type interrupt. Lots of examples of this on the forums.

If your going micro to micro then you probably don't need to level shift the signals (unless you are running the signals for any distance). If you attach the programs you have so far then we can have a look and maybe suggest where to look next. A working description of your hardware setup will also help, clock speed, etc.

beejo
Posts: 31
Joined: Thu Sep 11, 2008 12:46 pm
Location: TheNetherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Can V6 simulate RXINT?

Post by beejo »

Hi Benj,
I am very glad that you are willing to have a look into my program.
First there is one Pic16F877A that intermediates between a controller and a camera and controls a Pan & tilt head via an L273D chip.
The controller can send “Visca” commands to adjust an Pan & tilt or gives “Visca” commands to the camera.
First the controller sends an inquiry to e.g. the camera, the camera sends back an ACK and then the controller sends the appropriate command.

On this moment the Pic read the commands from the controller and sent them also to the camera. The camera responds with the good commands.
But The Pic doesn't read the camera commands on port B Tx=B6, Rx=B7
The controller is connected on port C of the E06 board via one E015 board on the connector J2 (to PC)
On J2 the Rx pin is pin 3,Tx pin is pin 2,
The camera is connected on port B of the E06 board via another E015 board on the connector J2 (to PC)
On J2, the same, the Rx pin is pin 3,Tx pin is pin 2,

The led A1 and A2 (see the macro : UART_RX_intReader Out1 to A1 under “Send command immediately to Cam” and Out 1to A2 above “New_STR=1”) flashes normally synchronous with the sending commands of the controller.

However the Pic program crashes as soon as I connect the read wire of the PIC port B/E015board J2 (toPC) pin3 to the Tx wire of the camera (read cam command). The led A2 stays lit and the Pic stops to send any commands but the led A1 is still flashing synchronous with the controller commands on Port C.
At the moment I disconnect the camera-TXwire and reset the programmer board port B starts sends the commands from the controller. And both led’s are flashing normally.

During compilation I notice the stack overflow warning see note 4 above in main program.
I try to add the software stack extension by adding the code –sw 6 2 to the end of the linker/assembler parameters. But during compilation I got an error :

Error: Failed to open:2.
failure
Resultaat = -2
Assembleren mislukt vanwege de foutmelding:

KLAAR

I hope that you can help me with this.
Thanks in advance

I tried to add the Visca document in pdf form but the mail server refuses this.
On note 1in the main program you can find the settings Visca used.

Beejo
Attachments
RS232communication between 2devices.fcf
(108.78 KiB) Downloaded 346 times

beejo
Posts: 31
Joined: Thu Sep 11, 2008 12:46 pm
Location: TheNetherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Can V6 simulate RXINT?

Post by beejo »

Hi Benj,
Finally succeeded to load the Visca protocol file.
Do you have any idea why the camera messages cannot be read through portB?
Beejo
Attachments
Visca commands.pdf
(209.06 KiB) Downloaded 297 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: Can V6 simulate RXINT?

Post by Benj »

Hello,

I've had a good look through your interrupt service macro and it looks really good to me so not sure what the issue is here. One potential pitfall could be if a RXINT interrupt occurs during a software RS232 receive then data may be missed or corrupted. Do you have access to a scope or a logic analyser which you could maybe use to monitor the external signals and maybe help to pinpoint where the problem lies?

beejo
Posts: 31
Joined: Thu Sep 11, 2008 12:46 pm
Location: TheNetherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Can V6 simulate RXINT?

Post by beejo »

Hi benJ,
No I haven’t a scope or logic analyser. The only thing I can do is to use the program Micterm. With this program I monitor the RS232 signals.
I fully agreed with your assumption that the interrupts do not works like they have to do.

For that I tried to don’t use the interrupt on port B and read on RB7 after sending the command to the camera on RB6. Because the camera message is an reaction on the controller command. That seems to work but I got only the last one command instead of the minimal 2 commands. Now I don’t trust the Port interrupt solution I did in the program. For that I try to use the RB0INT on pin RB0.
I make the necessary jumper changes on the 015 board on port B and rearrange the program. But with less result.

Still in RB0INT mode I try the following:
Because the controller sends regularly, about every 2 seconds, 2 or more strings I read all strings at once in a buffer string (60Char). After reading I send it at once to the Right RS232 component.

In the simulation mode it works. The controller command's are read and sent to the appropriate rs232 component. The camera messages are also be read and sent to the appropriate RS232 component. (I switch off both interrupts icons and instead off that I make for both interrupts a macro call in the while loop one for the RXINT, first command in while loop, and one for RB0INT immediately after sending the camera commands, after the macro call in main loop.

In the field “bytes in queue” of both RS232 components I put the corresponding test strings
Teststring:
Receive from Controller: 129,01,00,01,255,129,01,04,98,03,255 = Hex 81,01,00,01,FF,81,01,04,62,03,FF
receive from Camera: 144,65,255,144,80,255,144,81,255 = Hex 90,41,FF,90,50,FF,90,51,FF


During the compilation i notice the following warning :

Serious Warning: Possible sw stack corruption, function 'FCD_RS2320_ReceiveRS232Char' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)
Serious Warning: Possible sw stack corruption, function 'FCD_RS2321_ReceiveRS232Char' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)

When I remove one Interrupt during compilation only one warning appears.

Why these warnings? And is this possible the reason the interrupts not work properly?

Each time (about every 2 seconds) a command is sent by the controller these leds:
-A0 blinks after reading the complete buffer string. See macro: Uart_RX-Intreader.
-
-A1 does not to blink but have to blink after sending camera command string. See macro: SendCommandToCam.
However on the camera read line (Pic RB1, Controller commands to the camera) appears only
81 FF FF FF FF and not the two complete strings. Only one byte 0x81 (the camera adress) is good .

-A5 blinks Meaning there is a good camera command adress from controller arrived. See macro: RX_String_Handler.

These leds stays off:
-A2 doesn't blink but have to blink means that there is an message string sended to the controller. See macro: SendCamMessageToController.
-A3 doesn't blink but have to blink means that there is read a message string from the camera. See macro: ReadPortB


Please would you like to look at the enclosed revamped programme?
Please help me quickly with this pressing problem.



Kind regards,

Beejo
Attachments
RS232communication between 2devices REV E.fcf
(56.36 KiB) Downloaded 304 times

Post Reply