Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC communications

Status
Not open for further replies.

graemeian

New Member
I have two PICit kits and I am trying to communicate between the two.
The transmitter uses the PIC16f630 with the following code...
loop:
Serout PORTC.2, 300, "UUU"
WaitMs 33
Toggle PORTC.1
WaitMs 33
Toggle PORTC.1
Goto loop
I can see the square wave data from portc.2 using an o-scope.
This output pin is connected to the RX pin PORTC.5 of a PIC16f1459
I am trying the following code but It appears the interrupt is never called.
Any suggestions?
Thank you.

loop:
For i = 1 To 5
Toggle PORTC.1 'toggle LED for testing
WaitMs 20
Toggle PORTC.1
WaitMs 5
Next i

INTCON.PEIE = 1
Enable

UsbService
Toggle PORTC.3 'Another test to see if loop is active
WaitMs 20
Toggle PORTC.3
WaitMs 2


Goto loop
End
On Interrupt
Serin PORTC.5, 300, an3
Resume


'USB stuff below:




feature_report_received:
Toggle PORTC.2
an2 = an2 + 2

Return

feature_report_before_sending:
UsbFtBuffer(0) = x(0) 'UsbFtBuffer(0) - 1
UsbFtBuffer(1) = x(1) 'usbftbuffer(1) - 1
UsbFtBuffer(2) = x(2) 'UsbFtBuffer(2) - 1
UsbFtBuffer(3) = x(3) 'usbftbuffer(3) - 1
UsbFtBuffer(4) = x(4) 'usbftbuffer(4) - 1
UsbFtBuffer(5) = i 'I can see how many data points were sent
UsbFtBuffer(6) = an2
UsbFtBuffer(7) = an3
Return

output_report_received:
'Toggle PORTC.3
'WaitMs 200
Return

input_report_before_sending:
UsbIoBuffer(0) = 3 'usbiobuffer(0) + 1
UsbIoBuffer(1) = 1 'usbiobuffer(1) + 1
UsbIoBuffer(2) = 4 'usbiobuffer(2) + 1
UsbIoBuffer(3) = 1 'UsbIoBuffer(3) + 1
UsbIoBuffer(4) = 5 'usbiobuffer(4) + 1
UsbIoBuffer(5) = 9 'usbiobuffer(5) + 1
UsbIoBuffer(6) = 1 'usbiobuffer(6) + 1
UsbIoBuffer(7) = 5 'usbiobuffer(7) + 1
Return
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top