To let the PIC sleep I config first an interrupt on portG, Pin G15 to wake him up if I press ON-Button on G15.
Then I let him sleep with this asm comand
asm volatile ( "wait" );
in a C code Icon.
It's working like this...
By the program start the PIC(board) needs 140mA
after the wait command the PIC(board) needs 90mA and some buttons has no fuction.
If I press the ON-Button it goes back to 140mA and the another buttons are working again.
90mA is still to much.....
In the manual I found this info
I read the value of the register and send it to the terminalprogram.OSCCON:
bit 4 SLPEN: Sleep Mode Enable bit
1 = Device will enter Sleep mode when a WAIT instruction is executed
0 = Device will enter Idle mode when a WAIT instruction is executed
It give me this value
1 0001 0010 0010
Means bit 4 is 0 (idle mode)
In FC8, how can I set register OSSCON bit4 to 1 ?