PDA

View Full Version : program runs and stop



Phaxkp
- 24th May 2016, 18:49
hi i need help, my program runs and stops at a certain line, at PORTA = 0, i.e after TRISC = %00000000 ( checked with the ICD compile). i use pic16f886. what could be the prolem? compiles successfully though.thanksAmber var PORTB.1Good var PORTB.3time_up var PORTB.2Correct var PORTB.0Play var PORTB.5i var bytev var bytepalo var byteleds var wordleds.byte0 = PORTAleds.byte1 = PORTCleds= 0 @ errorlevel -306 ; V_1 var PORTA.0V_2 var PORTA.1V_3 var PORTA.2V_4 var PORTA.3V_5 var PORTA.4V_6 var PORTA.5V_7 var PORTA.6V_8 var PORTA.7V_9 var PORTC.0V_10 var PORTC.1V_11 var PORTC.2V_12 var PORTC.3V_13 var PORTC.4V_14 var PORTC.5V_15 var PORTC.6V_16 var PORTC.7TRISA = %00000000TRISB = %00100001TRISC = %00000000PORTA = 0 'LEDs offPORTB = 0PORTC = 0

Demon
- 25th May 2016, 03:17
Start by editting your post, add CODE tags (click on GO ADVANCED), and then split your lines.

That will make it easier for people to help.

Robert

Dave
- 25th May 2016, 21:37
hi i need help, my program runs and stops at a certain line, at PORTA = 0, i.e after TRISC = %00000000 ( checked with the ICD compile). i use pic16f886. what could be the prolem? compiles successfully though.

thanksAmber var PORTB.1
Good var PORTB.3
time_up var PORTB.2
Correct var PORTB.0
Play var PORTB.5
i var byte
v var byte
palo var byte
leds var word
leds.byte0 = PORTA
leds.byte1 = PORTC
leds= 0
@ errorlevel -306;
V_1 var PORTA.0
V_2 var PORTA.1
V_3 var PORTA.2
V_4 var PORTA.3
V_5 var PORTA.4
V_6 var PORTA.5
V_7 var PORTA.6
V_8 var PORTA.7
V_9 var PORTC.0
V_10 var PORTC.1
V_11 var PORTC.2
V_12 var PORTC.3
V_13 var PORTC.4
V_14 var PORTC.5
V_15 var PORTC.6
V_16 var PORTC.7
TRISA = %00000000
TRISB = %00100001
TRISC = %00000000
PORTA = 0 'LEDs off
PORTB = 0
PORTC = 0

From what I can see there is NO program here. Only configurations for the processor. Is this all of the program?

HenrikOlsson
- 26th May 2016, 07:26
Actually this

leds.byte0 = PORTA
leds.byte1 = PORTC
leds= 0
and this

TRISA = %00000000
TRISB = %00100001
TRISC = %00000000
PORTA = 0 'LEDs off
PORTB = 0
PORTC = 0
is "program" but yeah, something's weird.....

Are you using the ICD in Microcode studio? I don't know how that works exactly but my guess is that a "program" which is just running off into the wild like that probably doesn't work very well with the software debugger since it inserts calls to the "debug engine" between each statement. When there's no more statement there will be no more calls to the debug engine and it'll look like the program stopped.

If that really IS all of the program then at least add an END statement to it or better yet, for ICD testing purposes, add an endless loop at the bottom

Forever:
i = i + 1
Pause 1
Goto Forever

/Henrik,

Demon
- 26th May 2016, 15:45
@ errorlevel -306;

What does this do?

mackrackit
- 26th May 2016, 16:07
@ errorlevel -306 ' supress page boundry error