serin with 08m2 and 14m2

nerdegutta

Senior Member
Hi.

Is there any difference in 14m2's B.1 and 08m2's C.1 when working with serin? Shouldn't I be able to change IC and change from B.1 to C.1?

When 14m2 is in breadboard, it works. Changing to 08m2 and C.1, it's not working.

To me, that is very strange....

- nerdegutta
 

Goeytex

Senior Member
Seems to me it should work fine. In fact you shouldn't even have to change from B.1 to C.1 since
the 08M2 does not differentiate between PortC and PortB. In other words, either B.1 or C.1 can
used with the 08M2 and they both refer to Picaxe leg 6.
 

nerdegutta

Senior Member
Please provide both program(s) and circuits.
Program for 14m2
Code:
#no_data



symbol GPS_RX		= B.1

main:
	gosub rx_gps_data
	gosub tx_gps_data
	
	goto main


rx_gps_data:
	bptr = 53
 	serin GPS_RX, T4800, ("$GPGGA"),@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptr
return

tx_gps_data:
bptr = 54
sertxd ("$GPGGA,", @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptr,cr,lf)
										 
return
Program for 082
Code:
#no_data



symbol GPS_RX		= C.1

main:
	gosub rx_gps_data
	gosub tx_gps_data
	
	goto main


rx_gps_data:
	bptr = 53
 	serin GPS_RX, T4800, ("$GPGGA"),@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptr
return

tx_gps_data:
bptr = 54
sertxd ("$GPGGA,", @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptr,cr,lf)
										 
return
Everything is breadboarded, and with the 14m2 ic in place, HyperTerm shows the GPGGA sentence. When Changing to to 08m2, and to C.1, HyperTerminal doesn't show anything. I expect it to show the same as with the 14m2.

Schematic is coming...


- nerdegutta
 

Goeytex

Senior Member
When complicated code does not work, it might be a good idea to simplify it to bare basics to get to the root of the problem. For example: Try eliminating the qualifier and receiving just one byte into B0 and see what happens. Troubleshooting is a usually a process of elimination.

You might also try increasing the Processor clock to M8

#picaxe 08M2
#no_data
setfreq M8

Then use <Serin T4800_8 > instead of T4800_4
 
Last edited:

neiltechspec

Senior Member
Try setfreq m8 and serin GPS_RX, T4800_8.

I had to serin at 16mhz for reliable reading of 9600 baud on a Solar Inverter display which originally ran on a 14m2 and was then changed to an 08m2.

Also had to serin at 32Mhz for 19200 baud with an 08m2 on another application.
 

Goeytex

Senior Member
nerdegutta,

I tried it here on an 8M2 and it would not work at 4800_4 ... That's with the sending device sending at true 8N1. (No extra space between bytes sent). However, with the processor on the 8M2 increased to M8, it works ok at 4800_8.

So increase the 8M2 Processor speed to M8 and use serin T4800_8. You could also increase to M16 and use T4800_16
 

nerdegutta

Senior Member
Hi,

I've tried the above suggestions, and now it comes some random crap on the screen.

Guess I have to use the 14m2, but it's a big waste of pins...

- nerdegutta
 

nerdegutta

Senior Member
The IC receives iok with T4800_8. When I set #terminal 4800 it shows garbage, but when I change the termainla window to 9600, it displays what I want it to display. Now I need it to display it in 4800, but how?

- nerdegutta
 

nerdegutta

Senior Member
Solved!

Thanks for all the help guys!

This is now working:
Code:
#picaxe 08m2
#no_data
#terminal 4800


symbol GPS_RX		= C.1

main:
	gosub rx_gps_data
	gosub tx_gps_data
	
	goto main


rx_gps_data:
setfreq M8
	bptr = 53
 	serin GPS_RX, T4800_8, ("$GPGGA"),@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptr
return

tx_gps_data:
setfreq M4
bptr = 54
sertxd ("$GPGGA,", @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,_
										 @bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptr,cr,lf)
										 
return
I had to change the frequency back and forth. Probably not the smoothes program...

- nerdegutta
 

hippy

Ex-Staff (retired)
If you really need the output at 4800 you can replace the SERTXD(...) with SEROUT C.0,N4800_8,(...)
 

MPep

Senior Member
Also, if you double the frequency, then the SERTXD baud rate also doubles, so if you'd used "#terminal 9600" all would have appeared okay.
 

Goeytex

Senior Member
MPep raises a good point. It is a good practice to begin each program with relevant and appropriate directives.

Code:
#picaxe 08M2     [COLOR="#008000"] 'Tells the PE what Picaxe model is being programmed. Also lets folks
                   'know know What Picaxe you are using when you post code.  [/COLOR]
                 [COLOR="#008000"] ' If you don't say folks can only guess. [/COLOR]

#no_data          [COLOR="#008000"] 'Don't write or erase EEPROM Data - Speeds up programming[/COLOR]
#no_table         [COLOR="#008000"] ' X2 - Don't look for table OR  EEPROM data to load. [/COLOR]
#com 2            [COLOR="#008000"]  'Tells the program what com port the Programming Cable/Adapter is on[/COLOR]
#terminal 9600  [COLOR="#008000"]  'Open the Terminal at a specific baud rate.  [/COLOR]
 
Top