void start_train(void) {
RedSig = 0; // Red off
GrnSig = 1; // Set Green
__delay_ms(2000); // for about 2 sec.
Sound = 0; // Turn sound on
__delay_ms(100); // for about 0.1 sec. short pulse required
Sound = 1; // Sound off
INTCONbits.GIE = 0; // prevent branches to the interrupt address (0004h).
INTCONbits.IOCIE = 1; //Set IOC enable
RedSig = 1; // This happens [b]Test 1[/b]
SLEEP(); // Put it to sleep wakeup on busy pin going high RB4
RedSig = 0; // This happens [b]Test 2[/b]
//INTCONbits.GIE = 1; Test 5 commented out, program steps thru but rest will not work without GIE
__delay_ms(1000); [b]added just in case[/b]
RedSig = 1; //This does not happen [b]Test 4[/b]
INTCONbits.IOCIF = 0;// Clear the flag
INTCONbits.IOCIE = 0;// Clear enable
RedSig = 1; //This does not happen [b]Test 3[/b]
START = 1;
grandpa jay wrote:drh
I moved the INTCONbits.GIE = 1; to after the call to start the train and it appears to work. But does not cure the static on the sound. May have to go to a separate supply. The sleep is acting as a delay until the recorded sound is finished. That a good thing. I will leave it in.
Jay
Return to 14-Bit Core (enhanced)
Users browsing this forum: No registered users and 1 guest