PDA

View Full Version : MCS+ ICD Freezes



mslaney
- 3rd February 2005, 04:46
Hi there,
I'm using MCS+ ICD and it just stops on the fourth command. For instance, in the code below the ICD will freeze on "porta = %00000000". If I rem that line out it will freeze on the next and so on.
The program runs fine without the ICD running.
Does anybody have any ideas?


'Defines

define OSC 20
define LOADER_USED 1

trisa = %00000000
trisb = %00000000
trisc = %00000000

porta = %00000000
portb = %00000000
portc = %00000000

'Variables and Constants
counter var word 'For-Loop variable
servo var byte 'Servo output pin
'servo = portb.5

'Servo movement module

spin_CCW:
counter = 0
for counter = 1 to 100
pulsout portb.5, 150
pause 20
next

spin_CW:
counter = 0
for counter = 1 to 100
pulsout portb.5, 1500
pause 20
next
goto spin_ccw
end

mister_e
- 3rd February 2005, 05:14
i'm not sure of it but... what about if you switch your 2 first lines like this

define LOADER_USED 1
define OSC 20

capitano
- 3rd February 2005, 08:54
Try

Disable Debug

define LOADER_USED 1
define OSC 20


trisa = %00000000
trisb = %00000000
trisc = %00000000

porta = %00000000
portb = %00000000
portc = %00000000

'Variables and Constants
counter var word 'For-Loop variable
servo var byte 'Servo output pin
'servo = portb.5


Enable Debug


'Servo movement module

spin_CCW:
counter = 0
for counter = 1 to 100
pulsout portb.5, 150
pause 20
next

spin_CW:
counter = 0
for counter = 1 to 100
pulsout portb.5, 1500
pause 20
next
goto spin_ccw
end

mslaney
- 3rd February 2005, 13:17
niether change is working. Switching the defines didn't change anything and enable/disable debug times out when I click the ICD start button.

ICD is working with most of my other programs as long as the main part of the program is within 4 lines of the chip registers and port init states.
I'm using a 16F876A and compiling the program with that MCU in the drop-down. I've also tried changing OSCs and speeds in the .inc file.

For example, the following program works ok with ICD:

define OSC 20
define LOADER_USED 1

trisa = %00000000
trisb = %00000000

top:
porta = %11111111
portb = %11111111
pause 1000
porta = %00000000
portb = %00000000
pause 1000
goto top

NavMicroSystems
- 3rd February 2005, 18:07
Mike

you have already found the the solution to your problem.
you just haven't realised it.


The problem is with:

trisc = %00000000

the HWUSART TX and RX pins are on portc.6 and portc.7
and you are setting RX (which is supposed to be an input) to output.
This will stop the ICD from working
since bidirectional communitaction between PIC and PC is no longer possible.

with
trisc = %10000000
it should work.

mslaney
- 3rd February 2005, 21:31
Hah!!!

Thanks! Changing the tris reg. worked. This will fix 2 other programs that have brought me to my knees in frustration.

NavMicroSystems
- 3rd February 2005, 21:36
Hi Mike,

good to know your problem has been solved.

mister_e
- 3rd February 2005, 23:07
why i didn't see it damn... seems i become older and my glasses need to be changed...

NavMicroSystems
- 4th February 2005, 00:12
Hi Steve,

it's probably just because your "favourite" chips
(the ones you have plenty on shelf of)

don't have HWUSART and Loader cabability.

As long as you are able to solder SMD devices your glasses (and Health in general) are ok.

;-)

mister_e
- 4th February 2005, 00:37
Thanks ralph for the good words ;) Looks like my glasses and my health are not so bad after all... SMD is much than easy to do.

For the very first time in my life i did a mistake, and i'll have to live with it.

LMAO!

mslaney
- 4th February 2005, 13:06
I thought I was wrong once but i was mistaken