/************************************************************* cursor set *************************************************************/ void set_curser(unsigned char temp) { unsigned char i = 0; Check_LCDBusy(); // Check this spoint i = temp; i &= 0xF0; WriteNibble(i); i = temp<<4; i &= 0xF0; WriteNibble(i); }
/************************************************************** Cursor ON or OFF **************************************************************/ void curser_ONOFF(unsigned char temp) { unsigned char i = 0; i = temp; i &= 0xF0; WriteNibble(i); i = temp<<4; i &= 0xF0; WriteNibble(i); }
/************************************************************* Set LCD line [ For Line 1: temp = 0x80h; Line 2: temp = C0h **************************************************************/ void SetLine(unsigned char temp) { unsigned static char i = 0; Check_LCDBusy(); // Check this spoint i = temp; i &= 0xF0; WriteNibble(i); i = temp<<4; i &= 0xF0; WriteNibble(i); }
/************************************************************** DDRAM address **************************************************************/ void DDRAMadrs(unsigned char temp) { unsigned char i = 0; i = temp; i &= 0xF0; WriteNibble(i); i = temp<<4; i &= 0xF0; WriteNibble(i); }
/************************************************************** ENTRY Mode **************************************************************/ void EntryMode(unsigned char temp) { unsigned char i = 0; i = temp; i &= 0xF0; WriteNibble(i); i = temp<<4; i &= 0xF0; WriteNibble(i); }
/************************************************************** Dsplay Clear **************************************************************/ void DisplayClr(unsigned char temp) { unsigned char i = 0; i = temp; i &= 0xF0; WriteNibble(i); i = temp<<4; i &= 0xF0; WriteNibble(i); }
/************************************************************** function set **************************************************************/ void FunctionSet(unsigned char temp) { unsigned char i = 0; i = temp; i &= 0xF0; WriteNibble(i); i = temp<<4; i &= 0xF0; WriteNibble(i); }
void LCDinit(void) { PORTA = 00; // Clear Control port LATA = 00; // and its corresponding Latch TRISA = 0x01; // Make PORTA as output port ADCON1 = 0x0E; // Make PORTA as digitital I/O // This is done here assuming application code may be using PORTA of Analog application. _delay(4); // _delay(4); // _delay(4); //~15 ms delay WriteNibble(0x30); // #1 control byte _delay(4); WriteNibble(0x30); // #2 control byte _delay_100us(); WriteNibble(0x30); // #3 control byte _delay_100us(); WriteNibble(0x20); // #4 control sets 4 bit mode _delay_100us(); Check_LCDBusy(); // Check whther LCD is free to continue operation FunctionSet(0x28); // #5 control byte Function set DisplayON (0x0D); // Turn on Display DisplayClr (0x01); // Clear Display (clears junk if any) EntryMode(0x06); // Entry mode selection DDRAMadrs(0x80); // Initialise DDRAM address to 80h. } // LCD Init ends
void CDiskImageDos::Nibblize() { int sector, length; m_iGcrPos = ( MAX_TRACK_BYTES - 1 ) - ( ( m_nTrack*768 ) % MAX_TRACK_BYTES ); memset( m_abyNibBuffer, 0xFF, MAX_TRACK_BYTES ); // write gap one, which contains 48 self-sync bytes WRITE_SYNC( 64 ); for( sector = 0; sector < 16; sector++ ) { // write the address field, which contains: // - PROLOGUE ( D5 AA 96 ) // - VOLUME NUMBER ("4 AND 4" ENCODED) // - TRACK NUMBER ("4 AND 4" ENCODED) // - SECTOR NUMBER ("4 AND 4" ENCODED) // - CHECKSUM ("4 AND 4" ENCODED) // - EPILOGUE ( DE AA EB ) WriteNibble(0xD5); WriteNibble(0xAA); WriteNibble(0x96); #define CODE44A(a) ((((a) >> 1) & 0x55) | 0xAA) #define CODE44B(a) (((a) & 0x55) | 0xAA ) WriteNibble( CODE44A((BYTE)m_uVolumeNo) ); // Volume = 254 WriteNibble( CODE44B((BYTE)m_uVolumeNo) ); WriteNibble( CODE44A( (BYTE)m_nTrack ) ); // track WriteNibble( CODE44B( (BYTE)m_nTrack ) ); WriteNibble( CODE44A( sector ) ); // sector WriteNibble( CODE44B( sector ) ); WriteNibble( CODE44A(0xFE ^ ((BYTE)m_nTrack) ^ sector) ); // checksum WriteNibble( CODE44B(0xFE ^ ((BYTE)m_nTrack) ^ sector) ); #undef CODE44A #undef CODE44B WriteNibble( 0xDE ); WriteNibble( 0xAA ); WriteNibble( 0xEB ); // write gap two, which contains six self-sync bytes WRITE_SYNC( 6 ); // write the data field, which contains // - PROLOGUE ( D5 AA AD ) // - 343 6-BIT BYTES OF NIBBLIZED DATA, INCLUDING A 6-BIT CHECKSUM // - EPILOGUE ( DE AA EB ) WriteNibble( 0xD5 ); WriteNibble( 0xAA ); WriteNibble( 0xAD ); Code62( sm_abySectorOrder[m_pbyLogicalOrder[sector]] ); // 343 bytes WriteNibble( 0xDE ); WriteNibble( 0xAA ); WriteNibble( 0xEB ); // write gap three, which contains 27 self-sync bytes WRITE_SYNC( 27 ); } }