EB-006 V7 strange happenings

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
Burtonian
Posts: 10
Joined: Thu Aug 12, 2010 7:18 am
Has thanked: 1 time

EB-006 V7 strange happenings

Post by Burtonian »

I have now started programming the PIC16F88 that was supplied with my EB-006. I have started simple by turning on 6 LED's on Port B, bits 0 to 5. I did this by soldering some wires to a 9 pin plug and connecting them to 6 LED's, this worked fine. So I changed the program to turn on the LED connected to Port B bit 0 when I operated a push button switch that was connected to Port A bit 1. This did not work because the LED is on all the time. Thinking that I might have wired the switch incorrectly I removed all the wires from Port A and the light still kept on flickering. I then noticed that if I moved my hand over or near the EB-006 the light came on. Also if I placed the USB lead that I use to program the EB-006 close by the light comes on.
Whilst I was typing this I have just walked over and put my hand near the EB-006 and the LED on Port B bit 1 comes on and there is nothing connected to Port A at all.

Please can anyone tell me how on earth am I supposed to test my programs. Is there a fault with my EB-006 or is this a "feature" that I have to live with.

I am putting it away now before I stamp on it.

Regards
Burtonian

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: EB-006 V7 strange happenings

Post by medelec35 »

Burtonian wrote: I then noticed that if I moved my hand over or near the EB-006 the light came on.
That would suggest you have selected the wrong i/p in your flowchart.
The input you have selected, is not the one connected to your switch.
This means that the flowchart is looking at and input with nothing connected to it, or you have got a switch connected from the i/p to ground without a pull-up resistor connected.
So if switch is off, then i/p is floating. Either way, if i/p is floating, then input resistance is very high, so when u place your finger on or near, there is enough electrical noise induced to pin, to make i/p go from logic 0 to logic 1, hence making led light.
Check your flowchart and make sure i/p are assigned to correct pins.
Failing that post your flowchart, and I will take a look at it for you.
We need to eliminate connections and flowchart before deciding hardware is faulty.
Martin

Burtonian
Posts: 10
Joined: Thu Aug 12, 2010 7:18 am
Has thanked: 1 time

Re: EB-006 V7 strange happenings

Post by Burtonian »

Hi Medelec35,

Thank you for your reply.
I have checked that I have wired the correct pins on the chip to the switches and they appear to be correct.
Since I have reconnected the pcb and power supply I am not getting problems with static from my hand or the usb lead, so that is something positive.
I have also discovered that no matter how I change around the simple flowcode that I am using the LED that I select as an output lights up regardless of the input switch's position, even if I remove the input wires from the pcb.
Whilst using the EB-006 should I have the input pins pulled down to 0volts. So that when I apply 5v to the input pin the program sees it as a "1". If I put a value of pushed =0 after reading the input pin the LED stays off, so I dont think that there is a short circuit on the pcb.
I have attached the flowcode that I am using to test the LED. I would be very grateful if you could have a look at it for me please.
Regards

Burtonian
Attachments
16F88_1_led.fcf
(6 KiB) Downloaded 287 times

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: EB-006 V7 strange happenings

Post by medelec35 »

You will need a pull down resistor e.g 4K7 to 100K or so, connedted between the i/p of pin 18 and ground. You wil not require pushed = 0 since if switch is not pressed, pin 18 will be pulled low so i/p is read as 0 any way.
If Switch is pressed, pin 18 will be read as high, so pin 9 will go from low to high.
However the problem you have is with your flowchart.
You have not disabled the watchdog timer and you my need to change the osc to HS. Also Low voltage programming is enabled. You are best disabling this as well.
What you have to do is select chip menu then configure.
Click on 'Switch to expert config screen'
Here you can disable low voltage programming, watchdog timer, Background debug etc.
Try this attached version.
Attachments
16F88_1_led_Modified.fcf
(6 KiB) Downloaded 303 times
Martin

Burtonian
Posts: 10
Joined: Thu Aug 12, 2010 7:18 am
Has thanked: 1 time

Re: EB-006 V7 strange happenings

Post by Burtonian »

Hi Medelec35,

Thank you for the updated flowchart, it works fine. I get so confused about the actual pics, some people say leave the pins floating but now at least I know that the pins need to be held down. However what I am trying to do is make a program that everytime the button is pressed it increments from LED1 to LED2, LED3 etc and so far I just cannot get it to work. I have made lots of flowcharts and they all work perfectly on the simulator but not on the actual pic.
However I am now getting very good at compiling my feeble efforts to the chip.

I will have another go in the morning.

Thank you for your help

Regards

Burtonian

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: EB-006 V7 strange happenings

Post by medelec35 »

Just glad your hardware is ok :-)
Burtonian wrote:what I am trying to do is make a program that everytime the button is pressed it increments from LED1 to LED2, LED3 etc and so far I just cannot get it to work. I have made lots of flowcharts and they all work perfectly on the simulator but not on the actual pic.
However I am now getting very good at compiling my feeble efforts to the chip.

I will have another go in the morning.

Thank you for your help

Regards

Burtonian
Your welcome.
This is one way of incrementing LED's.
Since you have not said what you want LED's to do after last one lit,I have done it so if button is pressed again, the 1st LED lights again.

I Have added a couple of delays and a routine which waits for you to release switch before LED changed state. Other wise in the time the switch is pressed and released, the program will loop so fast, It will look like a random LED has lit, and not in sequence,
Attachments
16F88_1_led_Modified2.fcf
(7 KiB) Downloaded 284 times
Martin

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: EB-006 V7 strange happenings

Post by medelec35 »

Burtonian wrote:Hi Medelec35,

some people say leave the pins floating
The pins you can leave unconnected, are any unused pins or outputs.
All input pins that are enabled must never be floating.
If you want to assign several inputs, or connect switches to several inputs. To save on hardware (although resistors are very cheap :P) If target device allows ,then you can assign i/p pins with weak pull-ups (WPU) Then you can leave pins unconnected. This is usually available to only one port e.g portB. Information on how to do this is within the microcontroller datasheet. If you need help setting up WPU's let me know and I can assist you further.
Martin

Burtonian
Posts: 10
Joined: Thu Aug 12, 2010 7:18 am
Has thanked: 1 time

Re: EB-006 V7 strange happenings

Post by Burtonian »

Hi Medelec35

Thank you for modifying the program for me, needless to say it works fine. What I actualy want to do is all the time the button is pushed I would like the LED to stay on and then go out once the button is released. Then the second LED to come on when the button is pushed again etc. I am sorry about the delay in replying but I have been up most of the night trying to make the LED's work in the manner that I said.

Thank you once again.

Burtonian

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: EB-006 V7 strange happenings

Post by medelec35 »

Burtonian wrote:What I actualy want to do is all the time the button is pushed I would like the LED to stay on and then go out once the button is released. Then the second LED to come on when the button is pushed again etc.
Burtonian
Oh I see.
See if this is more suited to your requirements.

Regards
Martin.
Attachments
16F88_1_led_Modified3.fcf
(7.5 KiB) Downloaded 311 times
Martin

Burtonian
Posts: 10
Joined: Thu Aug 12, 2010 7:18 am
Has thanked: 1 time

Re: EB-006 V7 strange happenings

Post by Burtonian »

Hi Medelec35,

About 2 mins before I recieved your reply I had just finished my very long flowcode program. Thankfully it does work but I cant believe how much smaller and tidier your version is. It only goes to reinforce the feeling that I have a very very long way to go before I can write an efficient flowcode program.
I notice in your calculations you use entrys like "Output = Output<<1". What does <<1 mean.

Have you any idea's why everytime I try to add an output to my panel I get an error message something about being unable to determine the language I am using so it is defaulting to english.

Thank you once again for all your help.

Regards

George

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: EB-006 V7 strange happenings

Post by medelec35 »

Burtonian wrote:I notice in your calculations you use entrys like "Output = Output<<1". What does <<1 mean.
George
<<1 means shift 1 place to the left. This is the same Doubling.
eg if Output =32 = 0b00100000 then
Output = Output<<1 would x 2 so Output =64 = 0b01000000
Notice how the 1 has shifted to the left.
Burtonian wrote: Have you any idea's why everytime I try to add an output to my panel I get an error message something about being unable to determine the language I am using so it is defaulting to english.
This can occour with some setups.
You could try the following:
Select 'View' then 'Global Options'
select 'override language' and set to English.
See if that helps

As for creating more efficiant codes, one way is to look at the Flowcode V4 Examples form here:
http://www.matrixmultimedia.com/Flowcode3a-X.php
There are loads of examples scattered about the forum.
Eg here:
http://www.matrixmultimedia.com/mmforum ... m.php?f=26
Martin

Post Reply