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.

Ports won't display

Status
Not open for further replies.

jasbertfalutine

New Member
Hi everybody,
i have tried to write a simple program to display on led.
i used the template source and the linker script from microchip but i keep getting an error on stack underflow at address 0x00005 of my 16f877a chip
 
Last edited:
Is that all? - that seems lacking in many of the required lines?, such as setting the config fuses, specifying the processor and include file etc.

Also, 'incf portb' isn't complete, and probably isn't a good choice anyway?.
 
I never use either MPLAB, or the simulator, I just use MPASMWIN, the assembler part of MPLAB - and test the programs on hardware.

But how about correcting the 'incf' line?.
 
jasbertfalutine said:
what could i use instead of "incf portb" command

You could try adding all the parameters to it?, what destination are you sending the result to?. I can't even remember what the default is?, but it's important to add the destination to the end of such commands - in this case ', f' so the answer is written back to the port.

However, in this case, the rapid 'read, modify, write' might be a problem?, and I would suggest incrementing a GPR instead, then moving it to the port.
 
Code:
banksel trisb
movlw b'00000000'
movwf trisb
                       ;<<< misssing banksel portb here
clrf wreg
clrf portb

start incf portb
goto start
end

Hate to tell you but you are still in bank1, whereas portb is in bank0.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top