Need help - need to flash a LED on PortA

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
    this is driving me insane.  I am unable to figure out why my code
(below) to blink a LED on PortA does not work.  The test circuit is
fine.  Everything compiles and burns onto the 628A PIC chip.  But it
does not do jack.  

Could someone please help me out here.

Thank you,

;portsend.asm to show to flash a led on porta, ra0.

;************************************* setup

list p = 16F628A ;processor type
org 0020h

STATUS equ h'3'
CMCON equ h'1F'
TRISA equ h'85'
RP1 equ h'6'
RP0 equ h'5'
PORTA equ h'05'
reg1 equ h'20'

;************************************* program

goto Start

 MOVLW 0x07    ;disable the comparators

 bsf STATUS, RP0  ;switch to bank 1
 bcf STATUS, RP1

 movlw b'00000000'   ;all IO pins = outputs
 movwf TRISA

 bcf STATUS, RP0   ;switch back to bank 0
 bcf STATUS, RP1

 movlw b'00000000'       ; all port pins = low
 movwf PORTA
 goto Test

 movlw d'255'     ;counter to delay for a few milliseconds
 movwf reg1
 BSF PORTA,0    ;set porta, bit 0 on
 goto Decrement1     ;begin delay
 BCF PORTA,0     ;set porta, bit 0 off
 movlw d'255'
 movwf reg1
 goto Decrement2
 goto Test

 decfsz reg1, 1
 goto Decrement1
 goto Back1

 decfsz reg1, 1
 goto Decrement2
 goto Back2


Re: Need help - need to flash a LED on PortA
On Fri, 19 Dec 2003 22:18:46 GMT, the renowned zalzon

Quoted text here. Click to load it

You need to set an org for the code memory. Try using CBLOCK
rather than org for the file registers, if you want to write your
program in absolute.

Quoted text here. Click to load it

Best regards,
Spehro Pefhany
"it's the network..."                          "The Journey is the reward"             Info for manufacturers:
We've slightly trimmed the long signature. Click to see the full one.
Re: Need help - need to flash a LED on PortA
Hi, pic code starts at org0 not 20. You can find some templates on the
microchip site. Some chips have adconverters on porta, they come up as analoge
from reset.

Site Timeline