CONFIG IESO = OFF CONFIG FCMEN = OFF CONFIG OSC = HSPLL CONFIG BORV = 0 CONFIG BOREN = OFF CONFIG PWRT = ON CONFIG WDT = OFF CONFIG WDTPS = 128 CONFIG MCLRE = ON CONFIG LPT1OSC = OFF CONFIG PBADEN = OFF CONFIG CCP2MX = PORTBE CONFIG STVREN = ON CONFIG LVP = OFF CONFIG DEBUG = OFF CONFIG XINST = OFF CONFIG CP0 = OFF CONFIG CP1 = OFF CONFIG CP2 = OFF CONFIG CP3 = OFF CONFIG CPB = OFF CONFIG CPD = OFF CONFIG WRT0 = OFF CONFIG WRT1 = OFF CONFIG WRT2 = OFF CONFIG WRT3 = OFF CONFIG WRTB = OFF CONFIG WRTC = OFF CONFIG WRTD = OFF CONFIG EBTR0 = OFF CONFIG EBTR1 = OFF CONFIG EBTR2 = OFF CONFIG EBTR3 = OFF CONFIG EBTRB = OFF ;**************************************************************************** ;Defines & Macros ;**************************************************************************** Send_String macro string_address clrf TBLPTRU,A movlw HIGH string_address movwf TBLPTRH,A movlw LOW string_address movwf TBLPTRL,A call Table_To_RS232 endm ;**************************************************************************** ;Defines ;**************************************************************************** cblock 0x20 BANK0 : 1 delay_1 : 1 delay_2 : 1 delay_3 : 1 TXBUFF : 1 ;USART transmit buffer RCBUFF : 1 ;USART recieve buffer RCWait : 1 ;wait counter, used as timeout for RS232 LOOP : 1 ;general perpose loop counter TEMP : 1 ;Temporary Store PH : 1 CMDPH : 1 ;high byte of the command pointer CMDPL : 1 ;low byte of the command pointer CODEPH : 1 ;high byte of the code pointer CODEPL : 1 ;low byte of the code pointer COMMAND : d'32' ;stores the command sent from the termianl (up to 32 bytes) PRINTDATA : 5 ;stores the command sent from the termianl (up to 32 bytes) endc ;**************************************************************************** ;Bit Definitions ;**************************************************************************** ;10 - D0-D9: DAC data ;1 - LAT: DAC latch ;1 - RST: DAC reset ; ;1 - THM: Head temperature, analogue ; ;1 - NCHG: ? ;1 - CH: ? ;1 - LAT: ? ; ;1 - SCK: Clock ;1 - SI1: Head data - black ;1 - SI2: Head data - colour ;---- ;19 pins ;***PORTA*** PA0 equ 00h ; PA1 equ 01h ; PA2 equ 02h ; PA3 equ 03h ; PA4 equ 04h ; PA5 equ 05h ; OSC1 equ 06h ;not available, used for oscillator OSC2 equ 07h ;not available, used for oscillator ;***PORTB*** RTS equ 00h ;Input from the PC, is set to 0 when data is ready to be sent CTS equ 01h ;Output to the PC, set to 0 when we are ready to recieve DAC0 equ 02h ; DAC1 equ 03h ; DACLAT equ 04h ; DACRST equ 05h ; PGC equ 06h ;not available, used for programming clock PGD equ 07h ;not available, used for programming data ;***PORTC*** SI2 equ 00h ;Colour data line SI1 equ 01h ;Black data line CLK equ 02h ;Clock LAT equ 03h ;? CH equ 04h ;? NCHG equ 05h ;? ;RX equ 06h ;already defined in 18f4620.inc ;TX equ 07h ;already defined in 18f4620.inc ;***PORTD*** DAC2 equ 00h ;Epson chip D2 DAC3 equ 01h ;Epson chip D3 DAC4 equ 02h ;Epson chip D4 DAC5 equ 03h ;Epson chip D5 DAC6 equ 04h ;Epson chip D6 DAC7 equ 05h ;Epson chip D7 DAC8 equ 06h ;Epson chip D8 DAC9 equ 07h ;Epson chip D9 ;***PORTE*** PE0 equ 00h ; PE1 equ 01h ; PE2 equ 02h ; MCLR equ 03h ;not available, used for RESET and programming ;***Other*** W equ 0 F equ 1 C equ 0 DC equ 1 Z equ 2 ;crystal = 10MHz ;PLL = x4 ;effective oscillator frequency = 40MHz ;clock frequency = eof/4 = 10MHz ;one clock cycle = 100ns Osc_Freq equ d'40000000' Dealy_50us_Constant equ ((((Osc_Freq/d'80000')-7)/3)+1) A equ 0 B equ 1