I am still playing with a 16f610. I have the soft serial out working fine but serial in giving me a fit. Evertime I try to compile with serial in I get the following error. Here is the error and code>
Error: GCASM: Symbol SET 5.2.0 has not been defined.
;Defines (Constants)
#define SendBHigh set portc.0 on
#define SendBLow set portc.0 off
#define RecBLow set porta.2 on
#define RecBHigh set porta.2 off
Ansel = 0
Dir PORTc.0 Out
Dir PORTa.2 In
;Variables
Dim b0 As byte
Dim b1 As byte
Dim b2 As byte
Dim b3 As byte
Dim b4 As byte
Dim b5 As byte
Dim b6 As byte
Dim b7 As byte
Dim b8 As byte
Dim b9 As byte
Dim b10 As byte
Dim b11 As byte
Dim b12 As byte
Dim b13 As byte
Dim A1 As byte
Dim A2 As byte
Dim A3 As byte
Dim A4 As byte
Dim v1 As byte
#define RecBLow set porta.2 on
#define RecBHigh set porta.2 off
try removing the set - its not shown in the help example. You could probably move the InitSer commands out of the subs and up above Start: as they likely only need to be run once.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#define RecBLow set porta.2 on
#define RecBHigh set porta.2 off
try removing the set - its not shown in the help example. You could probably move the InitSer commands out of the subs and up above Start: as they likely only need to be run once.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Taking the set out got it to work. Can't believe I missed that. Looked at it a 100 times. The problem I have now is it only works on portA.3. Is there a reason for this. I thought because it was an input only pin that it was a hardware thing. I use picaxes all the time and I can serial in on any pin capable of input. Is there something I am missing? Here is the last code used:
;Defines (Constants)
#define SendAHigh set portc.0 on
#define SendALow set portc.0 off
#define RecALow porta.3 off
#define RecAHigh porta.3 on
;Variables
Dim b0 As byte
Dim b1 As byte
Dim b2 As byte
Dim b3 As byte
Dim b4 As byte
Dim b5 As byte
Dim b6 As byte
Dim b7 As byte
Dim b8 As byte
Dim b9 As byte
Dim b10 As byte
Dim b11 As byte
Dim b12 As byte
Dim b13 As byte
Dim AD1 As byte
Dim AD2 As byte
Dim AD3 As byte
Dim AD4 As byte
Dim v1 As byte
Ansel = 0
Dir PORTc.0 Out
Dir PORTA.3 In
AD1 = 0
AD2 = 0
AD3 = 0
AD4 = 0
b0 = 0
b1 = 0
b2 = 0
b3 = 0
b4 = 0
b5 = 0
b7 = 0
b8 = 0
b9 = 0
b10 = 0
b11 = 0
b12 = 0
start:
serin
If b9 <75 Then
set portc.2 on
else
set portc.2 off
end if
serout
goto start
The A3 or MCLR pin is always an input. Declare the RX pin as an input, like in the help example, with the dir command (e.g. dir PortC.0 in). Same thing goes for declaring say a button, and other digital inputs.
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did that to start with I had it as
dir porta.2 in
and
#define RecALow porta.2 off
#define RecAHigh porta.2 on
It would compile just fine but all I recieved was garbage. It would not recieve the data that was sent. It would recieve something because it went on to serial out. As soon as I changed pins it worked great.
I also removed Ansel = 0 to see if that had any effect, it did not.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am still playing with a 16f610. I have the soft serial out working fine but serial in giving me a fit. Evertime I try to compile with serial in I get the following error. Here is the error and code>
Error: GCASM: Symbol SET 5.2.0 has not been defined.
Code:
;Chip Settings
#chip 16F610,8
#config OSC=INTRC_OSC_NOCLKOUT
;Defines (Constants)
#define SendBHigh set portc.0 on
#define SendBLow set portc.0 off
#define RecBLow set porta.2 on
#define RecBHigh set porta.2 off
Ansel = 0
Dir PORTc.0 Out
Dir PORTa.2 In
;Variables
Dim b0 As byte
Dim b1 As byte
Dim b2 As byte
Dim b3 As byte
Dim b4 As byte
Dim b5 As byte
Dim b6 As byte
Dim b7 As byte
Dim b8 As byte
Dim b9 As byte
Dim b10 As byte
Dim b11 As byte
Dim b12 As byte
Dim b13 As byte
Dim A1 As byte
Dim A2 As byte
Dim A3 As byte
Dim A4 As byte
Dim v1 As byte
start:
wait 100 ms
serin
wait 100 ms
serout
b0 = 0
b1 = 10
b2 = 2
b3 = 3
b4 = 4
b5 = 5
b6 = 6
b7 = 7
b8 = 8
b9 = 9
b10 = 10
b11 = 11
b12 = 12
b13 = 13
goto start
Sub serin
InitSer 2, r4800, 1 + WaitForStart, 8, 1, None, Normal
SerReceive 2, b0
SerReceive 2, b1
SerReceive 2, b2
SerReceive 2, b3
SerReceive 2, b4
SerReceive 2, b5
SerReceive 2, b6
SerReceive 2, b7
SerReceive 2, b8
SerReceive 2, b9
SerReceive 2, b10
SerReceive 2, b11
SerReceive 2, b12
SerReceive 2, b13
End Sub
Sub serout
InitSer 1, r4800, 1+ WaitForStart, 8, 1, None, Invert
Serprint 1, Data
SerSend 1, b0
SerSend 1, b1
SerSend 1, b2
SerSend 1, b3
SerSend 1, b4
SerSend 1, b5
SerSend 1, b6
SerSend 1, b7
SerSend 1, b8
SerSend 1, b9
SerSend 1, b10
SerSend 1, b11
SerSend 1, b12
SerSend 1, b13
End Sub
In the two lines -
#define RecBLow set porta.2 on
#define RecBHigh set porta.2 off
try removing the set - its not shown in the help example. You could probably move the InitSer commands out of the subs and up above Start: as they likely only need to be run once.
In the two lines -
#define RecBLow set porta.2 on
#define RecBHigh set porta.2 off
try removing the set - its not shown in the help example. You could probably move the InitSer commands out of the subs and up above Start: as they likely only need to be run once.
Taking the set out got it to work. Can't believe I missed that. Looked at it a 100 times. The problem I have now is it only works on portA.3. Is there a reason for this. I thought because it was an input only pin that it was a hardware thing. I use picaxes all the time and I can serial in on any pin capable of input. Is there something I am missing? Here is the last code used:
;Chip Settings
#chip 16F610,8
#config OSC=INTRC_OSC_NOCLKOUT, MCLRE=OFF, WDT=OFF
;Defines (Constants)
#define SendAHigh set portc.0 on
#define SendALow set portc.0 off
#define RecALow porta.3 off
#define RecAHigh porta.3 on
;Variables
Dim b0 As byte
Dim b1 As byte
Dim b2 As byte
Dim b3 As byte
Dim b4 As byte
Dim b5 As byte
Dim b6 As byte
Dim b7 As byte
Dim b8 As byte
Dim b9 As byte
Dim b10 As byte
Dim b11 As byte
Dim b12 As byte
Dim b13 As byte
Dim AD1 As byte
Dim AD2 As byte
Dim AD3 As byte
Dim AD4 As byte
Dim v1 As byte
Ansel = 0
Dir PORTc.0 Out
Dir PORTA.3 In
AD1 = 0
AD2 = 0
AD3 = 0
AD4 = 0
b0 = 0
b1 = 0
b2 = 0
b3 = 0
b4 = 0
b5 = 0
b7 = 0
b8 = 0
b9 = 0
b10 = 0
b11 = 0
b12 = 0
start:
serin
If b9 <75 Then
set portc.2 on
else
set portc.2 off
end if
serout
goto start
Sub serin
Set PORTC.4 On
InitSer 1, r4800, 1+ WaitForStart, 8, 1, None, Invert
SerReceive 1, AD1
SerReceive 1, AD2
SerReceive 1, AD3
SerReceive 1, AD4
SerReceive 1, b0
SerReceive 1, b1
SerReceive 1, b2
SerReceive 1, b3
SerReceive 1, b4
SerReceive 1, b5
SerReceive 1, b6
SerReceive 1, b7
SerReceive 1, b8
SerReceive 1, b9
SerReceive 1, b10
SerReceive 1, b11
SerReceive 1, b12
SerReceive 1, b13
Set PORTC.4 Off
End Sub
Sub serout
Set Portc.3 On
InitSer 1, r4800, 1+ WaitForStart, 8, 1, None, Invert
SerSend 1, AD1
Sersend 1, AD2
Sersend 1, AD3
Sersend 1, AD4
SerSend 1, b0
SerSend 1, b1
SerSend 1, b2
SerSend 1, b3
SerSend 1, b4
SerSend 1, b5
SerSend 1, b6
SerSend 1, b7
SerSend 1, b8
SerSend 1, b9
SerSend 1, b10
SerSend 1, b11
SerSend 1, b12
SerSend 1, b13
Set PORTC.3 Off
End Sub
The A3 or MCLR pin is always an input. Declare the RX pin as an input, like in the help example, with the dir command (e.g. dir PortC.0 in). Same thing goes for declaring say a button, and other digital inputs.
Kent
I did that to start with I had it as
dir porta.2 in
and
#define RecALow porta.2 off
#define RecAHigh porta.2 on
It would compile just fine but all I recieved was garbage. It would not recieve the data that was sent. It would recieve something because it went on to serial out. As soon as I changed pins it worked great.
I also removed Ansel = 0 to see if that had any effect, it did not.