My project uses a 16F1936 on both a Master and a Slave board. Durring the program the Master sends a code for the Slave to run a subroutine to SLEEP. I am trying to use ASM SLEEP as to NOT designate a time to wake. twenty two hours after the slave enters sleep it recieves a USART comm which should WAKE the slave from SLEEP. Problem is the slave is not going to sleep, or it wakes right away after the command. So, how to trouble shoot SLEEP? I can't monitor the STATUS, PD bit while in sleep, I can only use an indicator LED when going into the SLEEP instruction and toggle it off when exit the sleep instruction, and it is toggling right away.
One observation is that PBP asks for a period whenever I type SLEEP in the ASM module. Can PBP tell the difference between ASM SLEEP and PBP SLEEP or are they both seen as a PBP command? Comments please.
The Master does not use the comm line for the next 22 hours.Code:;Slave Board PortA.1=1 Indicator LED RXceiveINT: INTbit=1 'Set Cvar to break out of Start loop Com_Enable=0 ' Con_enable not needed to RX hserin [Bvar] @ INT_RETURN ;goes back to INTerrupt locaion. which is Start loop. ;----------------------- CaseAction: busy=1 Select Case Bvar Case 0 ;No action taken if Not in Sleep Mode, Return only @ nop ;If in Sleep Mode, Wake up, goto Start @ nop @ nop Case 1 gosub Ran_num Case 2 gosub RappidFireRight case 3 gosub RappidFireLeft case 4 gosub Desolve case 5 gosub FlashFlies CASE 6 gosub SleepMode ;subroutine to place Slave in Sleep mode end select busy=0 return ;------------------Case6 SleepMode: PortA.1=0 ;Indicator LED out on entering SLEEP ASM BTFSS BAUDCON,RCIDL ;Check for High, no receive in progress GOTO $-1 BSF BAUDCON,WUE ;Wake on Rx from Master SLEEP nop nop nop ENDASM PortA.1=1 ;Indicator LED ON at exit SLEEP return end
Wayne




Bookmarks