My first project didnt work :-( Dont know why???

Status
Not open for further replies.

itsallgood

Member level 2
Joined
Mar 15, 2002
Messages
48
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
329
Please could someone help me. I've made my first circuit and it doesnt work. All that happens is that all the LED's stay on, all the time...

Here is my code (PicBasic Pro):

Code:
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _LVP_OFF & _CP_ALL & _DATA_CP_ON
loop: 
     low 2
   high 0           
   pause 100         
   low 0
   pause 100
   high 0 
   pause 100         
   low 0         
   pause 100
   high 0 
   pause 100                                                                                                                               
   low 0
   pause 100

   high 1          
   pause 100       
   low 1
   
    high 2
   pause 1000  
   
    goto loop 
   
end

This is my circuit - using a PIC 16F628:


**broken link removed**


If anyone could PLEASE, tell me what i've done wrong

It runs fine in proteus.

Cheers.
 

@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _LVP_OFF & _CP_ALL & _DATA_CP_ON

check wdt off

vdd connection error
and write hex to pic with correct option
 

    itsallgood

    Points: 2
    Helpful Answer Positive Rating
masud58, thanks for your fast reply,

Is that the only reason it didnt work?

so the top line should be:

Code:
@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _LVP_OFF & _CP_ALL & _DATA_CP_ON

Can you see any other reason why it wont work? I have to resolder the chip each time, so i would really like to make sure its right.

What do you mean by: "and write hex to pic with correct option"

Just rewrite the chip with that change? is that what you mean?


Thanks very much.
 

Hi I do not know pic basic just normal basic and C, assembler etc...

But do you not need to define the input and output pins ????

I do not see anything like that in your code.

Also I do not see any 5V on pin 14 vdd pin !!!!..

WDT_ON should be WDT_OFF !!

Paul.
 

I dont think you have to define the input and output pins in picbasic pro?

I didnt know that the vdd needed power aswell! thanks, i'll add that, so now my curcuit looks like this, and i've got the watchdog timer turned off.


**broken link removed**

Is that it? should i repogram and resolder?

Many thanks.
 

Hi Vdd should be direct to 5V not through a resistor !!.

And I am almost sure you have to define the pins as input and output !

I checked for you: **broken link removed** and indeed you have to define the pins using INPUT or OUTPUT statements.

Paul.
 

Thanks for all this help,

In the example "blink" using picbasic pro, they just use "high" and "low", i think these statments define them as outputs:

**broken link removed**

"HIGH Make pin output high. "
"LOW Make pin output low"

I'm going to have a go at reprogramming now.

I'll update in a sec if it works
 

try turning the comparotor off with this line
CMCON = 7 ' Analog comparators off
 

    itsallgood

    Points: 2
    Helpful Answer Positive Rating
YES!!!

It works!!! (kind of), -- its way too fast.

In proteus, the time is spot on (flashes for 3secs, then the 3rd LED is on for 10secs), but on my acutal circuit, the whole sequance is over in a few secs.

I think thats somthing i have to sort out in proteus.
I'm going to change all my "pause 100" into "1000" and that should be it.

Thanks so much for all the help!
 

Hi

Its not a good idea to solder and re solder the IC many times. I would recommend an IC base. It would prevent the IC from being exposed to the soldering heat many times.

Kannan.k
 

yes Kannan.k is right you should use an ic socket which are cheap or get a zif socket or use in circuit programmg(ICSP).Repeated soldering and desoldering will destroy that chip pretty quickly
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…