• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

Communication between HCS12 and CFA635

crazybarracuda

New member
:confused: I am trying to send information from my HCS12 microcontroller to the CFA635 LCD screen. Could somebody please help me with the assembly code to do this.
Thanks.
:)
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
The CFA635 is a USB device. How are you interfacing it to a HCS12?

As for the code, I could probably give you some help, as I've done a lot of HC12 assembler.
 
Ok, so what do you need to know? Understand that I have zero experience with the CFA serial LCD products, but I can read the data sheet as well as you can.

Do you have some code already written? If so, better to post a file attachment than a long 'code' window.
 

crazybarracuda

New member
Firstly, I was hoping that there was a code for the HCS11 or HCS12 already written that I could use to help me with the programming. Since all the codes provided by Crystalfontz are in C++ and for the computer and for Windows in particular, I'm assuming that I would need to change all the code (including the header files) into assembly so as to work with the Motorola HCS12. I haven't had all that much programming experience and I'm picking stuff on as I go along. Hence a sample program for assembly to communicate with the CFA635 through the RS232 serial would help tremendously.
Anyway, I haven't started actually writing the code as yet. This I plan to start tomorrow morning. I can send some of the code written then and see if it makes sense.
Thanks
 
Hmm, I see. You have quite a chore in store. I don't know of any specific sample code that you could use. What is your application... meaning where are you getting the data that will be sent to the 635? Are you expecting to handle keypress messages? Or is this just an experiment that will develop into something larger?

You need to study the HCS12 data sheets (which chip part number are you using?), and determine the settings to initialize the registers, which could look something like this fragment:
Code:
start	sei
	movb #intram>>8 INITRM
	lds #stack
	movw #start 0,SP
	ldy #regtbl
1$	ldx 2,Y+			;init cpu registers
	bmi 2$
	movb 1,Y+ 0,X
	bra 1$

***************************************
;	cpu register inits after reset
***************************************

regtbl	dc.w MODE
	dc $80			;normal single chip mode
	dc.w IRQCR
	dc 0			;IRQ disabled
	dc.w REFDV
	dc 7			;pll ref div = 8
	dc.w SYNR
	dc 11			;pll mult = 12
	dc.w PLLCTL
	dc $E1			;pll & cme on
	dc.w CLKSEL
	dc 5 			;pll not sel, CWAI on, COPWAI on
	dc.w COPCTL
	dc $46			;RSBCK on, COP = osc / 2^23 (16MHz/8388608 = 524 mS)
	dc.w RTICTL
	dc $71			;rtc = osc / 2^17 (16MHz/131072 = 8.192 mS)
	dc.w HPRIO
	dc $EE			;timer 0 highest priority
	dc.w DDRA
	dc $FF			;port A all outputs (lcd data)
	dc.w PORTB
	dc LCD_RST+W2_SDA+W2_SCL		;lcd reset off, rtc/EE bus idle
	dc.w DDRB
	dc $FF			;port B all outputs (lcd, com, rtc/EE, alm control)
	dc.w PUCR
	dc $12			;pullups on PORTB, PORTE inputs (need PORTB for W2_SDA)
	dc.w PPAGE
	dc $3E 
;;;;;;; lines skipped here
	dc.w $FFFF		;end of list
Then you need to declare memory space for your variables and comm buffers, and write handlers for the serial send & receive, either polled or interupt driven. I can give you more fragments, but you'll need to understand how the cpu works well enough to be able to fix bugs. What kind of debugging tools do you have?
 
Top