ross246
- 17th November 2010, 14:31
Hi Guys,
A while ago I got code working for my 16F690 that allowed me to communicate back and forth with my PC Serial Port. I Picked up some 12F683's however I am struggling to convert the code to work with the 12F683. The purpose of the project is to provide some sort of Software Protection for a program I have written in vb.net so I figured an 8 pin would be perfect I can even get power off the serial port.
Here is the existing code I have for my 16F690, if anyone has any time to point me in the right direction to use it on a 12F683
Include "modedefs.bas"
DEFINE OSC 4
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_SPBRG 25
DEFINE HSER_CLROERR 1
ANSEL = 0
ANSELH = 0
CM1CON0 = 0
CM2CON0 = 0
stat VAR byte
stat = " "
Main:
HSERIN [stat]
if stat = "0" Then goto reqSerial
GOTO Main
reqSerial:
HSEROUT ["51384529"]
GOTO MAin
END
I am using a max232 with the circuit. I have taken out some of the original code to make it easier to post here, should compile and it works on a 16F690 :)
Thanks,
Ross.
A while ago I got code working for my 16F690 that allowed me to communicate back and forth with my PC Serial Port. I Picked up some 12F683's however I am struggling to convert the code to work with the 12F683. The purpose of the project is to provide some sort of Software Protection for a program I have written in vb.net so I figured an 8 pin would be perfect I can even get power off the serial port.
Here is the existing code I have for my 16F690, if anyone has any time to point me in the right direction to use it on a 12F683
Include "modedefs.bas"
DEFINE OSC 4
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_SPBRG 25
DEFINE HSER_CLROERR 1
ANSEL = 0
ANSELH = 0
CM1CON0 = 0
CM2CON0 = 0
stat VAR byte
stat = " "
Main:
HSERIN [stat]
if stat = "0" Then goto reqSerial
GOTO Main
reqSerial:
HSEROUT ["51384529"]
GOTO MAin
END
I am using a max232 with the circuit. I have taken out some of the original code to make it easier to post here, should compile and it works on a 16F690 :)
Thanks,
Ross.