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.

First PIC project, what am I doing wrong??

Status
Not open for further replies.

CoximusPrime

New Member
Hi Guys,

I'm using a 16f627 pic for my first pic project (well technically second but this is completely from scratch). I have a vellaman vm111 "pic programmer and experiment board." Basically all I'm trying to do is write a simple assembly language program that sets a pin high to light an LED. The program I've written (see attached file) seems to work fine on the experiment board, the correct pin raises and the led lights, however, on my own breadboard circuit, nothing happens ... bad times.

I've attached an image (not the best quality, and please excuse the use of green wires, they're all I have access to at the moment) that shows the circuit that I'm trying to use, from what I can gather from examples and the PIC datasheet, it looks right to me; but it could be completly wrong as I'm pretty new to electronics. Can anyone tell me where I'm going wrong? Feel free to mock me if it is completly wrong. :)

Cheers everyone
 

Attachments

  • first_led_on_v2.asm
    2.2 KB · Views: 189
  • circuit.jpg
    circuit.jpg
    197.1 KB · Views: 209
Don't worry about the green wire. I use all red wire. ;)
Assuming the LED is wired the right way around, it looks OK. But I would add a 0.1uF cap across the Vdd and Vss leads of the PIC just to be safe. Measure to see that there is 5V between pin 14 and 5 right at the PIC.

As for the code, you shouldn't define the SFR's like TRISA, etc. Nor should you define the config constants. Delete all the stuff before the "start of program" comment, but keep the __CONFIG statement, and put this instead:
LIST p=16F627
#include <P16F627.inc>
 
Last edited:
FIXED!!!! :)

Cheers for all the replies guys, you've all been most helpful in not only helping fix my problem, but also passing on some good practices.

I feel like kind of a idiot because I had threated to check the LED was the correct way round, tested its resistance with my multimeter, which lit the LED and enabled me to establish which leg was which, but then must have proceeded to place it the wrong way round :) ... anyways, I put it the correct way round, and also tested the valtages between vss/vdd and MCLR, which all looked good, and it now work :)

So atleast now I can have a play with some more assembly to see what else I can get working.

Once again, thank for all your help.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top