12 switch to 12 LED
Moderator: Benj
-
christoph
- Flowcode V4 User
- Posts: 382
- Joined: Tue Nov 01, 2011 4:28 pm
- Has thanked: 196 times
- Been thanked: 26 times
12 switch to 12 LED
Hi all,
Desparate now!! All my hardware and sensors are ready but not been able to get electronics working for 12 ways.
PIC16F88, 12 switch Tx, then via UART (hardwired & wireless), to 12 LED Rx box. Effectively 12 clean contact sensors to 1 receiver with 12 LEDs, to indicate the continual status of the switches.
Despite very willing help from the forum - which is really appreciated - I can only get a 6-way system to actually work (and it works perfectly - hardwired or over a radio link).
Has anyone done this already and could post appropriate flowcharts for me to try?
Thanks in advance for any input that might help,
Chris
Desparate now!! All my hardware and sensors are ready but not been able to get electronics working for 12 ways.
PIC16F88, 12 switch Tx, then via UART (hardwired & wireless), to 12 LED Rx box. Effectively 12 clean contact sensors to 1 receiver with 12 LEDs, to indicate the continual status of the switches.
Despite very willing help from the forum - which is really appreciated - I can only get a 6-way system to actually work (and it works perfectly - hardwired or over a radio link).
Has anyone done this already and could post appropriate flowcharts for me to try?
Thanks in advance for any input that might help,
Chris
- 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: 12 switch to 12 LED
Hi Chris,
Looking at your old program it shouldn't be too hard to store 12 individual bits.
You will have to use 2 byte variables to store your data.
The first 8 will use byte 1 and the second 4 will use byte 2.
Then you simply the data into and out of the byte like this.
populate the byte
byte1 = 0
byte1 = byte1 | (data0)
byte1 = byte1 | (data1 << 1)
byte1 = byte1 | (data2 << 2)
byte1 = byte1 | (data3 << 3)
byte1 = byte1 | (data4 << 4)
byte1 = byte1 | (data5 << 5)
byte1 = byte1 | (data6 << 6)
byte1 = byte1 | (data7 << 7)
byte2 = 0
byte2 = byte2 | (data8)
byte2 = byte2 | (data9 << 1)
byte2 = byte2 | (data10 << 2)
byte2 = byte2 | (data11 << 3)
Hope this helps.
Looking at your old program it shouldn't be too hard to store 12 individual bits.
You will have to use 2 byte variables to store your data.
The first 8 will use byte 1 and the second 4 will use byte 2.
Then you simply the data into and out of the byte like this.
populate the byte
byte1 = 0
byte1 = byte1 | (data0)
byte1 = byte1 | (data1 << 1)
byte1 = byte1 | (data2 << 2)
byte1 = byte1 | (data3 << 3)
byte1 = byte1 | (data4 << 4)
byte1 = byte1 | (data5 << 5)
byte1 = byte1 | (data6 << 6)
byte1 = byte1 | (data7 << 7)
byte2 = 0
byte2 = byte2 | (data8)
byte2 = byte2 | (data9 << 1)
byte2 = byte2 | (data10 << 2)
byte2 = byte2 | (data11 << 3)
Hope this helps.
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
-
christoph
- Flowcode V4 User
- Posts: 382
- Joined: Tue Nov 01, 2011 4:28 pm
- Has thanked: 196 times
- Been thanked: 26 times
Re: 12 switch to 12 LED - help
Sorry Benj, thought I was getting the hang of things but I really not sure how to implement the information you posted - could you give me a bit more help to get this going for Tx and Rx - I've spent about 6 hours or more trying yesterday and today (and the past couple of weeks trying to do it myself - I'm obviously getting too old for this stuff) but I'm getting nowhere and I would like to at least complete this project!
Would really appreciate, many thanks,
Chris
Would really appreciate, many thanks,
Chris
- 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: 12 switch to 12 LED
Hi Chris,
What about attaching the program you have so far so we can try and spot what your doing wrong and steer you in the right direction.
What about attaching the program you have so far so we can try and spot what your doing wrong and steer you in the right direction.
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
-
christoph
- Flowcode V4 User
- Posts: 382
- Joined: Tue Nov 01, 2011 4:28 pm
- Has thanked: 196 times
- Been thanked: 26 times
Re: 12 switch to 12 LED
Hi Benj
thanks for the reply - please see the attachments which I am trying to get working and based on the last information you posted but as I said, I'm not sure whether I am implementing it properly - well obviously not I guess! Would be great if you can see what I am doing wrong.
I am not using any of the e-blocks by the way.
I have not used A2, A5, B2 and B5 to avoid complications as you will realise and I have nothing else connected apart from the necessary pull up/down resistors particularly the 10k pull ups on A5/MCLR.
Be great if I could get this sorted over the weekend and I do appreciate your help.
Best regards,
Chris
thanks for the reply - please see the attachments which I am trying to get working and based on the last information you posted but as I said, I'm not sure whether I am implementing it properly - well obviously not I guess! Would be great if you can see what I am doing wrong.
I am not using any of the e-blocks by the way.
I have not used A2, A5, B2 and B5 to avoid complications as you will realise and I have nothing else connected apart from the necessary pull up/down resistors particularly the 10k pull ups on A5/MCLR.
Be great if I could get this sorted over the weekend and I do appreciate your help.
Best regards,
Chris
- Attachments
-
- My attempt for the 12 LED 16LF88 UART Rx.fcf
- (14 KiB) Downloaded 311 times
-
- My attempt for the 12 SWITCH 16LF88 UART Tx .fcf
- (14.86 KiB) Downloaded 297 times
- 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: 12 switch to 12 LED
Hi Chris,
Here is a set of progs that should work. I have simplified it a lot and hopefully this should be very reliable on the hardware.
Here is a set of progs that should work. I have simplified it a lot and hopefully this should be very reliable on the hardware.
- Attachments
-
- 16LF88 UART Tx .fcf
- (12 KiB) Downloaded 305 times
-
- 16LF88 UART Rx.fcf
- (14 KiB) Downloaded 325 times
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
-
christoph
- Flowcode V4 User
- Posts: 382
- Joined: Tue Nov 01, 2011 4:28 pm
- Has thanked: 196 times
- Been thanked: 26 times
Re: 12 switch to 12 LED
Hi Benj,
Many thanks for your positive response and looking forward to checking them out but unfortunately I am getting the following 2 messages when I try to open the flowcharts:
"The file you are loading was made by a newer version of FlowCode (42>31) and may not load correctly. Do you wish to continue loading it YES / No"
On replying 'YES' :
"Unable to create microcontroller pic8 as the definition file pic8.FCD is missing or corrupt. [ 0x200]"
I then checked 'Updates' and it confirms my current version is 4.5 and is up to date!
Regards,
Chris
Many thanks for your positive response and looking forward to checking them out but unfortunately I am getting the following 2 messages when I try to open the flowcharts:
"The file you are loading was made by a newer version of FlowCode (42>31) and may not load correctly. Do you wish to continue loading it YES / No"
On replying 'YES' :
"Unable to create microcontroller pic8 as the definition file pic8.FCD is missing or corrupt. [ 0x200]"
I then checked 'Updates' and it confirms my current version is 4.5 and is up to date!
Regards,
Chris
- JohnCrow
- Valued Contributor

- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
Re: 12 switch to 12 LED
Hi Christoph
Looks like the programs Benj posted are in FC5.
Ive not been able to open them with FC 4.5.18.74, but do open with in FC5
Looks like the programs Benj posted are in FC5.
Ive not been able to open them with FC 4.5.18.74, but do open with in FC5
1 in 10 people understand binary, the other one doesn't !
- DavidA
- Matrix Staff
- Posts: 1076
- Joined: Fri Apr 23, 2010 2:18 pm
- Location: Matrix Multimedia Ltd
- Has thanked: 58 times
- Been thanked: 258 times
- Contact:
Re: 12 switch to 12 LED
Hi chris,
You can download the free v5 and you should be able to view the flowchart, you wont be able to compile to chip but i dont think thats what you want from it.
You can download the free v5 and you should be able to view the flowchart, you wont be able to compile to chip but i dont think thats what you want from it.
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: 12 switch to 12 LED
Hi Chris,
David's got a very good point,
but I starting the conversion before his post.
So Im going to carry on and post the V4 version of Ben's modifications.
But It's still very worth while downloading the free version of V5 to have a play, since there is a vast difference between V4 and V5
Free version can be found here:
http://www.matrixmultimedia.com/lc_index.php?p=25
I did notice that RX version you posted was not configured at all.
Martin
David's got a very good point,
but I starting the conversion before his post.
So Im going to carry on and post the V4 version of Ben's modifications.
But It's still very worth while downloading the free version of V5 to have a play, since there is a vast difference between V4 and V5
Free version can be found here:
http://www.matrixmultimedia.com/lc_index.php?p=25
I did notice that RX version you posted was not configured at all.
Martin
- Attachments
-
- 16LF88 UART TX Bens version converted from V5 to V4.fcf
- (9 KiB) Downloaded 307 times
-
- 16LF88 UART RX Bens version converted from V5 to V4.fcf
- (9.5 KiB) Downloaded 267 times
Martin
-
christoph
- Flowcode V4 User
- Posts: 382
- Joined: Tue Nov 01, 2011 4:28 pm
- Has thanked: 196 times
- Been thanked: 26 times
Re: 12 switch to 12 LED
Hi all....
BRILLIANT - It all works a TREAT - I am 'over the moon' - special thanks to Benj, John, David and Martin for sparing the time to get this going against all the odds with my lack of experience with both programming and micro controllers in general. I really appreciate all your help.
Martin, thanks for the conversion which as I happened to be here, meant that I could immediately try it out. The flowcharts I posted which were not configured were - I think - because I made a change because they didnt work, saved it but then realised it was a silly change and changed it back and posted straight away without configuring.
Cheers everyone - have as great a day as I am having!!
Best regards,
Chris
BRILLIANT - It all works a TREAT - I am 'over the moon' - special thanks to Benj, John, David and Martin for sparing the time to get this going against all the odds with my lack of experience with both programming and micro controllers in general. I really appreciate all your help.
Martin, thanks for the conversion which as I happened to be here, meant that I could immediately try it out. The flowcharts I posted which were not configured were - I think - because I made a change because they didnt work, saved it but then realised it was a silly change and changed it back and posted straight away without configuring.
Cheers everyone - have as great a day as I am having!!
Best regards,
Chris