Please forgive me, I am only a beginner...

I want my PIC to send the constant 'name' over the serial port to my computer when a button is pressed. This is my first time with PICBasic so I may be completely wrong but what I want to do is put the PIC to sleep until and interrupt occurs. When there is an interrupt on RB0, the PIC will wake up and send data along the serial port. Any coding help is greatly appreciated. The code is below...

-----------------------------------------------

program wdev1

const name = 0001

PORTB.0 = 1 'port RBO as input?

sub procedure interrupt 'interrupt procedure (I think)
if INTCON.INTF = 1 then 'check port RBO

USART_Write(name) 'send serial data (name)

Delay_ms(1000) 'delay 1 second

USART_Write(name) 'send second packet

INTCON.INTF = 0 'set RBO to 0

end if

end sub

main:

INTCON = %10010000 'allow interrupts?

USART_Init(2400) 'set baud rate to 2400

asm 'include assembler code

SLEEP 'sleep until interrupt method is called to preserve power

end asm

end.

-----------------------------------------------
Thanks a million!!