Serial Communication 40x2 to 20x2 - Abismal failure, please help

darosu

New Member
Hi guys...

...sorry to bother you all with another annoying 'i'm too stupid to figure it out' question...but here it is anyway:

I am trying to set up a 'graphics driver' chip from an 20X2. Effectively it will recieve serial data at 9600 then either send it out directly at 2400 to my Graphical LCD, or it will send user written subroutines for icons, menus etc.... However i have fallen down at the first hurdle.

I have a 40X2 running as a master with a 8MHZ resonator giving me 32Mhz

Code:
#Picaxe 40X2


setfreq em32	'currently running at standard 32Mhs of 40X2
pause 6000

hsersetup B9600_32, %100

pause 6000

hserout 0,("A")

pause 6000

hserout 0,("B")
 pause 6000
 
 end
so all it is doing is sending 2 bytes of data separated by a good pause



My 20X2 i running from the internal clock at 16 and has 2 LEDS...
First it powers on flashing both LEDS then it should light one then the other as the data comes in but it just sits there like a lemon

Code:
Picaxe 20X2

setfreq m16	'SPEED IS 16MHZ


'Pin Connections
'GLCD

symbol LED1=B.2
SYMBOL LED2=B.3



HSERSETUP B9600_16,%100

high LED1
high LED2
pause 2000
low LED1
low LED2

do
	if hserptr>1 then
		high LED1
	end if

	if hserptr>2 then
		low LED1
		high LED2
	end if
loop

The hserout of the 40x2 is directly connected to the HserIn of the 20X2


Any suggestions welcome

Thank

darosu
 

inglewoodpete

Senior Member
For your receiving end, you need to set bit #0 to True to enable backgroud receive.

The following code is from a post I made some time ago for the 28x1:

Code:
            HSerSetup B9600_8, %01        '%ab where a=0 No invert  a=1 Invert transmit;
            '                                    and b=0 Foreground b=1 Background Receive
Hope this helps.
 
Top