Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Why isn't this working?

Status
Not open for further replies.

Glacius

New Member
I recently made a circuitboard and insterted a Pic 16f628a microchip in it. When I tested it with running an LED over the positive and negative it works, yet when I try to run it over a pin that I programmed to send voltage to by holding the LED over the positive and negative, it doesn't work. It worked on my programmer (that comes with LEDS to show outputs) and I've included the source.
 

Attachments

  • robot1source.txt
    6.2 KB · Views: 168
I haven't soldered them on to the board yet, what I did is just put the anode on one of the pins (in this case RB0) and the cathode on the Vout pin by hand to see if it works.
 
Without a series resistor you're taking a chance there on the life of the LED.

Unless you have a schematic of the 'actual' board that you are using, it's near on impossible for anyone here to help.
For one thing, Nigel's tutorials ( that you have 'basically' copied the main board of ) use a different style of switch recognition to the Velleman.

If the code you have works on the K8048, but doesn't on your board, then it's 'your board' that has the problem. And as you haven't finnished building it yet, it's no wonder that it doesn't work.

Help us to help you...
 
Glacius said:
I just put the anode on one of the pins (in this case RB0) and the cathode on the Vout pin by hand to see if it works.

If the LED is a regular (+)Anode (-)Cathode, then LED(-) need to be connected to Ground not Vout and LED(+) to the PIC RB0 while RB0 is driven HIGH.

If the LeD is a reversed biasing type, then LED(-) must connect to Vout and LED(+) connect to RB0 while RB0 is driven LOW.

Provide a schematic of just a portion of your board, like the RB0-LED-RESISTOR-POWER-GROUND connections.
 
Two questions; Is VDD supposed to be connected to the positive terminal? And if I put a LED on the same main positive wire that goes to the microchip, is it supposed to turn on? Because mine isn't.
 

Attachments

  • RB0.jpg
    RB0.jpg
    21.2 KB · Views: 166
hi glacius,
Your diagram is OK.
Run your program thru my PIC sim.

The program goes into a constant loop at EFFECT_1.....
Both RB0 and RB1 are permanently high and should drive your LED.

If I edit your program........ change goto EFFECT_1 to, goto MENU, I can make the program execute EFFECT_2 and _3, by toggling AN0 and AN1 inputs.

I would suggest that the problem is on the pcb that you have built.

I dont know what assembler you are using, but I should have a look at MPLAB IDE 7.60 from www.microchip.com its free.

Your assembler looks like hard work!.

Regards
 
Thanks for the programming advice :) Yeah my problem probably is on my PCB. I'm also wondering if the "reset" part of my program has anything to do with it not working on my PCB. Anyway; I've attatched the schematics for the exact layout on my PCB. Although I've already showed how the connection for RB0 is done, and its the same for Rb1... ect.
 

Attachments

  • scalemainboard2.jpg
    scalemainboard2.jpg
    40 KB · Views: 170
Glacius said:
Thanks for the programming advice :) Yeah my problem probably is on my PCB. I'm also wondering if the "reset" part of my program has anything to do with it not working on my PCB. Anyway; I've attatched the schematics for the exact layout on my PCB. Although I've already showed how the connection for RB0 is done, and its the same for Rb1... ect.

hi,
Check pin#5, MCLR and the CONFIG word.

Are you using it as a I/O pin or MCLR?
 
My 9V battery is only reading 8.0V off my digital voltmeter, while when I connect the voltmeter over the microprocessor or the 1k ohm resistor, it only reads 3.22V. When I connect to the battery,however, it only reads 6.60-6.70V. Should I get a new battery or is there something wrong with my Voltage regulator? I'm pretty sure my voltmeter is accurate though because it reads a 1.5V cell as 1.57V.
 
Try following the schematic and program on your 16F628A (download the detailed .pdf from my site). Ignore the MPLAB stuff as your programmer is different.
**broken link removed**
 
Glacius said:
My 9V battery is only reading 8.0V off my digital voltmeter, while when I connect the voltmeter over the microprocessor or the 1k ohm resistor, it only reads 3.22V. When I connect to the battery,however, it only reads 6.60-6.70V. Should I get a new battery or is there something wrong with my Voltage regulator? I'm pretty sure my voltmeter is accurate though because it reads a 1.5V cell as 1.57V.

Hi,
It sounds like your 9Vbty [PP3?] has been fully discharged, you need a new one.

Alkaline PP3 9Vbtys are made up of 7, 1.2V cells, so you would expect about 8.4V on a good battery.
Also if you are using a standard +5Vreg it requires at least 2 to 3V across the Vreg to work within specification.

Regarding pin#5, IIRC you have configured it as MCLR, not RA5 ??, double check it...
 
ericgibbs said:
Hi,
It sounds like your 9Vbty [PP3?] has been fully discharged, you need a new one.

Alkaline PP3 9Vbtys are made up of 7, 1.2V cells, so you would expect about 8.4V on a good battery.
Also if you are using a standard +5Vreg it requires at least 2 to 3V across the Vreg to work within specification.

Regarding pin#5, IIRC you have configured it as MCLR, not RA5 ??, double check it...

So would you recommend me using 6x 1.5 V cells instead? Would AA or AAA be better? Is setting pin#5 to MCLR a bad thing? Sorry if I'm asking stupid questions or anything, I'm just new to this whole microcontroller concept, (and also programming in assembly). Does anyone have any tips to get atleast 4.5V or greater to the microcontroller since it's only getting around 3.2V to it?
 
Glacius said:
So would you recommend me using 6x 1.5 V cells instead? Would AA or AAA be better? Is setting pin#5 to MCLR a bad thing? Sorry if I'm asking stupid questions or anything, I'm just new to this whole microcontroller concept, (and also programming in assembly). Does anyone have any tips to get atleast 4.5V or greater to the microcontroller since it's only getting around 3.2V to it?

Hi,
The problem with alkaline batteries is that a single cell gives about 1.2V, the older zinc-carbon batteries gave about 1.5.
For some reason the industry seems to be stuck with the older ZincCarbon designation, IMO the correct voltage should be printed on alkaline batteries.

If I am correct and you have CONFIG pin#5 as MCLRE, ie:ON, it means the PIC is not being RESET at power up.
If its set to OFF, so that you can use it as an I/O pin, then the PIC's internal Reset line is connected to Vdd, so its reset OK.
That means you can use RA5 as a I/O pin.

Look at the CONFIG Word on the PIC's datasheet.

Are you using a +5Vregulator between the battery and the PIC??

Does this make it clear?
EDIT: Disregard the section re-alkaline battery voltages.... its NiCd
 
Last edited:
ericgibbs said:
Hi,
The problem with alkaline batteries is that a single cell gives about 1.2V, the older zinc-carbon batteries gave about 1.5.
For some reason the industry seems to be stuck with the older ZincCarbon designation, IMO the correct voltage should be printed on alkaline batteries.

The nominal cell voltage of alkaline batteries is 1.5V the same as zinc-carbon - you are perhaps thinking of NiCd or NiMh where it's only 1.2V?.

Check my (very old) discharge graphs at:
 
Status
Not open for further replies.

Latest threads

Back
Top