Helo Benj,
I'm having a bit of a problem with reading the state of a pin on a port.
I'm outputing a value 1 to port D7 that lights an LED and than I want to read the state of D7. I used an input Icon and stote the value into a variable "ash" next I used an decision Icon to check the variable and than decide what to do.
When I run the program in flowcode it simulates ok, but when I run it in my simulator it make D7 as an input and switches OFF the LED. It's obvious that pin D7 become an input!! I than inserted an output icon and made D7 1 again to light the LED this works in flowcode but not in the simulator.
What am I doing wrong?
How can I read tge state of a Port Pin if it's high or low with flowcode.
Thanks
Pinto
READDING A VALUE ON A PORT
-
- Flowcode v5 User
- Posts: 71
- Joined: Fri Nov 03, 2006 2:28 pm
- Location: RSA
- Been thanked: 1 time
Hi Ben,
I think I've got it.
Instead of using an INPUT Icon I created a variable that I pre-load with a 1 if it's true and with a 0 if false'
When I want to switch the LED I load the variable on RD7 with the output icon. That enable me to make further decision on RD7 later on.
Whwn I simulate on my simulator it works.
I was considering taking back my real state job again!!
By the way do you know off hand were I can get a good circuit for a PT100?
Regards
Pinto
I think I've got it.
Instead of using an INPUT Icon I created a variable that I pre-load with a 1 if it's true and with a 0 if false'
When I want to switch the LED I load the variable on RD7 with the output icon. That enable me to make further decision on RD7 later on.
Whwn I simulate on my simulator it works.

I was considering taking back my real state job again!!

By the way do you know off hand were I can get a good circuit for a PT100?
Regards
Pinto
- 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:
Hello Pinto
Another way you can do the read of the pin is to use a piece of C code. Unfortunately the input flowchart icon configures the pin back to being an input and therefore destroys the logic level being sent out. The C code that would do this would be
However this C code will also not simulate. I think the method you have adopted is probably the way forward.
Also here is an application note from Microchip referring to the PT100.
http://ww1.microchip.com/downloads/en/D ... 51607a.pdf
Another way you can do the read of the pin is to use a piece of C code. Unfortunately the input flowchart icon configures the pin back to being an input and therefore destroys the logic level being sent out. The C code that would do this would be
Code: Select all
test_pin(portb.0); //tests logic level of B0

Also here is an application note from Microchip referring to the PT100.
http://ww1.microchip.com/downloads/en/D ... 51607a.pdf
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