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.

gremlins in my pic!!

Status
Not open for further replies.

MrDEB

Well-Known Member
a real simple test code to make sure all the leds are operational but have gremlins in my code or pic?? must be a full moon
when I first apply power all the leds light. Then they all go off and then start cycling on/ off as per code. This should work?? Must have something really dumb in my code??

DEVICE = 18f2420

CLOCK = 8

INCLUDE "InternalOscillator.bas"

INCLUDE "SetDigitalIO.bas"

DIM x AS BYTE





x = 0


trisc =%00000000

portb = 0


WHILE true

FOR x = 0 TO 7

portc.bits(x) = 1


DELAYMS(1000)

portc.bits(x) = 0

DELAYMS(1000)

NEXT

WEND
 
If you have the SE version of swordfish, I would check that "SetDigitalIO.bas" has the ability to turn off the ADC on PORTB otherwise you need to edit the Config to disable the PBADEN bit!!

EDIT!! Sorry I saw the PORTB =0 and assumed PORTB...

I would use the Latch rather than the port register LATC.bits(x) =0;
 
May sound obvious but you have decoupling capacitors on the PIC voltage rail ? They do weird things when they aren't adequately decoupled.
 
May sound obvious but you have decoupling capacitors on the PIC voltage rail ? They do weird things when they aren't adequately decoupled.
I nominate for under stament of the year award :D. lol
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top