Define many constant in Assembly

Status
Not open for further replies.

Ayne

New Member
Code:
'   6x8 Font Table 
const font1 as byte[230] = 
(0x00, 0x00, 0x00, 0x00, 0x00 ,   '   space 
 0x00, 0x00, 0x2f, 0x00, 0x00 ,   '   ! 
 0x00, 0x07, 0x00, 0x07, 0x00 ,   '   " 
 0x14, 0x7f, 0x14, 0x7f, 0x14 ,   '   # 
 0x24, 0x2a, 0x7f, 0x2a, 0x12 ,   '   $ 
 0x62, 0x64, 0x08, 0x13, 0x23 ,   '   % 
 0x36, 0x49, 0x55, 0x22, 0x50 ,   '   & 
 0x00, 0x05, 0x03, 0x00, 0x00 ,   '   ' 
 0x00, 0x1c, 0x22, 0x41, 0x00 ,   '   ( 
 0x00, 0x41, 0x22, 0x1c, 0x00 ,   '   ) 
 0x14, 0x08, 0x3E, 0x08, 0x14 ,   '   * 
 0x08, 0x08, 0x3E, 0x08, 0x08 ,   '   + 
 0x00, 0x00, 0xA0, 0x60, 0x00 ,   '   , 
 0x08, 0x08, 0x08, 0x08, 0x08 ,   '   - 
 0x00, 0x60, 0x60, 0x00, 0x00 ,   '   . 
 0x20, 0x10, 0x08, 0x04, 0x02 ,   '   / 
 0x3E, 0x51, 0x49, 0x45, 0x3E ,   '   0 
 0x00, 0x42, 0x7F, 0x40, 0x00 ,   '   1 
 0x42, 0x61, 0x51, 0x49, 0x46 ,   '   2 
 0x21, 0x41, 0x45, 0x4B, 0x31 ,   '   3 
 0x18, 0x14, 0x12, 0x7F, 0x10 ,   '   4 
 0x27, 0x45, 0x45, 0x45, 0x39 ,   '   5 
 0x3C, 0x4A, 0x49, 0x49, 0x30 ,   '   6 
 0x01, 0x71, 0x09, 0x05, 0x03 ,   '   7 
 0x36, 0x49, 0x49, 0x49, 0x36 ,   '   8 
 0x06, 0x49, 0x49, 0x29, 0x1E ,   '   9 
 0x00, 0x36, 0x36, 0x00, 0x00 ,   '   : 
 0x00, 0x56, 0x36, 0x00, 0x00 , 
 0x08, 0x14, 0x22, 0x41, 0x00 ,   '   < 
 0x14, 0x14, 0x14, 0x14, 0x14 ,   '   = 
 0x00, 0x41, 0x22, 0x14, 0x08 ,   '   > 
 0x02, 0x01, 0x51, 0x09, 0x06 ,   '   ? 
 0x32, 0x49, 0x59, 0x51, 0x3E ,   '   @ 
 0x7C, 0x12, 0x11, 0x12, 0x7C ,   '   A 
 0x7F, 0x49, 0x49, 0x49, 0x36 ,   '   B 
 0x3E, 0x41, 0x41, 0x41, 0x22 ,   '   C 
 0x7F, 0x41, 0x41, 0x22, 0x1C ,   '   D 
 0x7F, 0x49, 0x49, 0x49, 0x41 ,   '   E 
 0x7F, 0x09, 0x09, 0x09, 0x01 ,   '   F 
 0x3E, 0x41, 0x49, 0x49, 0x7A ,   '   G 
 0x7F, 0x08, 0x08, 0x08, 0x7F ,   '   H 
 0x00, 0x41, 0x7F, 0x41, 0x00 ,   '   I 
 0x20, 0x40, 0x41, 0x3F, 0x01 ,   '   J 
 0x7F, 0x08, 0x14, 0x22, 0x41 ,   '   K 
 0x7F, 0x40, 0x40, 0x40, 0x40 ,   '   L 
 0x7F, 0x02, 0x0C, 0x02, 0x7F)    '   M 
  
 const font2 as byte[230] = 
(0x7F, 0x04, 0x08, 0x10, 0x7F ,   '   N 
 0x3E, 0x41, 0x41, 0x41, 0x3E ,   '   O 
 0x7F, 0x09, 0x09, 0x09, 0x06 ,   '   P 
 0x3E, 0x41, 0x51, 0x21, 0x5E ,   '   Q 
 0x7F, 0x09, 0x19, 0x29, 0x46 ,   '   R 
 0x46, 0x49, 0x49, 0x49, 0x31 ,   '   S 
 0x01, 0x01, 0x7F, 0x01, 0x01 ,   '   T 
 0x3F, 0x40, 0x40, 0x40, 0x3F ,   '   U 
 0x1F, 0x20, 0x40, 0x20, 0x1F ,   '   V 
 0x3F, 0x40, 0x38, 0x40, 0x3F ,   '   W 
 0x63, 0x14, 0x08, 0x14, 0x63 ,   '   X 
 0x07, 0x08, 0x70, 0x08, 0x07 ,   '   Y 
 0x61, 0x51, 0x49, 0x45, 0x43 ,   '   Z 
 0x00, 0x7F, 0x41, 0x41, 0x00 ,   '   [ 
 0x55, 0x2A, 0x55, 0x2A, 0x55 ,   '   / 
 0x00, 0x41, 0x41, 0x7F, 0x00 ,   '   ] 
 0x04, 0x02, 0x01, 0x02, 0x04 ,   '   ^ 
 0x40, 0x40, 0x40, 0x40, 0x40 ,   '   _ 
 0x00, 0x01, 0x02, 0x04, 0x00 ,   '   ' 
 0x20, 0x54, 0x54, 0x54, 0x78 ,   '   a 
 0x7F, 0x48, 0x44, 0x44, 0x38 ,   '   b 
 0x38, 0x44, 0x44, 0x44, 0x20 ,   '   c 
 0x38, 0x44, 0x44, 0x48, 0x7F ,   '   d 
 0x38, 0x54, 0x54, 0x54, 0x18 ,   '   e 
 0x08, 0x7E, 0x09, 0x01, 0x02 ,   '   f 
 0x18, 0xA4, 0xA4, 0xA4, 0x7C ,   '   g 
 0x7F, 0x08, 0x04, 0x04, 0x78 ,   '   h 
 0x00, 0x44, 0x7D, 0x40, 0x00 ,   '   i 
 0x40, 0x80, 0x84, 0x7D, 0x00 ,   '   j 
 0x7F, 0x10, 0x28, 0x44, 0x00 ,   '   k 
 0x00, 0x41, 0x7F, 0x40, 0x00 ,   '   l 
 0x7C, 0x04, 0x18, 0x04, 0x78 ,   '   m 
 0x7C, 0x08, 0x04, 0x04, 0x78 ,   '   n 
 0x38, 0x44, 0x44, 0x44, 0x38 ,   '   o 
 0xFC, 0x24, 0x24, 0x24, 0x18 ,   '   p 
 0x18, 0x24, 0x24, 0x18, 0xFC ,   '   q 
 0x7C, 0x08, 0x04, 0x04, 0x08 ,   '   r 
 0x48, 0x54, 0x54, 0x54, 0x20 ,   '   s 
 0x04, 0x3F, 0x44, 0x40, 0x20 ,   '   t 
 0x3C, 0x40, 0x40, 0x20, 0x7C ,   '   u 
 0x1C, 0x20, 0x40, 0x20, 0x1C ,   '   v 
 0x3C, 0x40, 0x30, 0x40, 0x3C ,   '   w 
 0x44, 0x28, 0x10, 0x28, 0x44 ,   '   x 
 0x1C, 0xA0, 0xA0, 0xA0, 0x7C ,   '   y 
 0x44, 0x64, 0x54, 0x4C, 0x44 ,   '   z 
 0x14, 0x14, 0x14, 0x14, 0x14)    '   horiz lines

How we define many constants in assembly
 
Code:
sub procedure NOK_Write (dim data as byte, dim mode as byte) 
dim i as short 
         for i = 0 to 7 step 1 
     '   Pull DC high for DATA or low for COMMAND 
     if TestBit(mode,0) = 1 then 
       SetBit(PortC,5) 
     end if 
     if TestBit(mode,0) = 0 then 
       ClearBit(PortC,5) 
     end if
next i 
End Sub

How we define a local variable in Macro in assembly. As we define local variable (i as byte) in above code.


One thing more, if some one already have a prebuilt macro file for Nokia3310 LCD then plz share or any link???
 
The only way on a PIC is to use RETLW tables. The MPASM helpfile shows you how to define them as data statements - or you could check my LED matrix tutorial, which defines fonts for display.
 
i found this, i think this can help me.

But my second post???? < not answered
 
can we countinu our program to next line in assembly(MPLAB). as in the following code
0x00, 0x2f, 0x00, 0x00 , ' !
0x00, 0x07, 0x00, 0x07, 0x00 ,
 
putting into next line

Code:
		; PROGRAM CODE
START
		MOVLW	B'10101010'
		MOVWF	PORTB
		NOP
		MOVLW	B'01010101'
		MOVWF	PORTB
		NOP

		A DT 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x07, 0x00, 0x07, 0x00 , 0x14, 0x7f, 0x14, 0x7f, 0x14 , 0x24, 0x2a, 0x7f, 0x2a, 0x12 

		End
As we can see there is a long data after "A DT". How can we put this data into two or three line???
 
Why not just write the table out?, it's hardly any different - here's a section of mine that I advised you to check earlier!. Notice I used binary as it makes it easy to see what's happening. Also please note, the fonts are upside down!.

Code:
Table		
		RETLW	b'00000000'		;SPACE
            	RETLW   b'00000000'
            	RETLW   b'00000000'		
            	RETLW   b'00000000'		
            	RETLW   b'00000000'		
            	RETLW   b'00000000'		
            	RETLW   b'00000000'		
            	RETLW   b'00000000'

		RETLW	b'00000000'		;!
            	RETLW   b'00010000'
            	RETLW   b'00000000'		
            	RETLW   b'00000000'		
            	RETLW   b'00010000'		
            	RETLW   b'00010000'		
            	RETLW   b'00010000'		
            	RETLW   b'00010000'

		RETLW	b'00000000'		;"
            	RETLW   b'00000000'
            	RETLW   b'00000000'		
            	RETLW   b'00000000'		
            	RETLW   b'00000000'		
            	RETLW   b'00101000'		
            	RETLW   b'00101000'		
            	RETLW   b'00101000'
 
yes u r right Nigel Goodwin, and DT command do the same job.
But it saves the time, there is no need of writing RETLW on each byte if i use DT command.
And i am learner i want to learn how to put long data into two or three lines??
 
Code:
sub procedure NOK_Write (dim data as byte, dim mode as byte) 
dim i as short 
     '   Pull DC high for DATA or low for COMMAND 
     if TestBit(mode,0) = 1 then 
       SetBit(PortC,5) 
     end if 
     if TestBit(mode,0) = 0 then 
       ClearBit(PortC,5) 
     end if 

     ClearBit(PortC,0)                                    '   CS = low 

     '   Clock in 8 bits of data - Highst bit first 
     for i = 7 to 0 step -1 
          ClearBit(PortC,4)                               '   SCLK = low 
          if TestBit(Data,i) = 0 then 
            ClearBit(PortC,6)                             '   SDA = low 
          else 
            SetBit(PortC,6)                               '   SDA = high 
          end if 
          SetBit(PortC,4)                                 '   SCLK = high 
     next i 
    SetBit(PortC,0)                                       '   CS = high 
end sub

I wrote the above program i assembly, i use dataa instead data cuz data is the reserve word of MPLAB.
Plz check the code............ it is write or worng???
Code:
;---------------------------------------------------------------------------------------------------
;		
;
;		NOK_Write	Macro
;---------------------------------------------------------------------------------------------------

NOK_Write	Macro	dataa, mode
		local		I

		if mode,0 == .1			;if mode = 1 then pull DC high
		bsf		DC
		endif

		if mode,0 == .0			;if mode = 0 for command pull DC low
		bcf		DC
		endif

		bcf		CS				;CS(Chip enable) low << because it active on low

    ;*************Clock in 8 bits of data - Highst bit first *************
		I 	equ		7

		bcf			SCLK		;SCLK - Serial Clock Input = low
		BTFSS		dataa,I
		bcf			SDA			;SDA  - Serial Data Input = low
		bsf			SDA			;SDA  - Serial Data Input = high
		bsf			SCLK		;SCLK - Serial Clock Input = high

		DECFSZ		I, F
		Goto		$ - 6
		bsf			CS			;CS   - Chip Enable = high
		
		Endm
I am in learning process, plz tell me if there is any thing wrong or how can i improve it.
 
First little about me.
I am learner and u r my teacher Nigel Goodwin.
I started from MikroBasic... 3 months ago
Then i leave it after 1 month cuz i was busy in other things.
Now i started again but MikroBasic is limited to 2Kb of program memory(it's free version).
Then i switch to Assembly language cuz it is more powerful and etc etc.
And i am learning from Ur tutorials, and from a book which is on www.mikroe.com website.

Why are you trying to write a macro?.
i want to make a *.INC file of th following code.
It's advantage is when i need to use nokia lcd with my project i will include this file into my project.

Code:
program Black 
include "NOKIA_LCD_16.pbas" 

main: 
    PORTC = 0 
    TRISC = 0 
    intcon = 0 
NOK_Init 
NOK_Clear 
    NOK_Out(0,2,"mikro") 
    NOK_Out(18,3,"ELEKTRONIKA") 
end. 
 


Code: 

module NOKIA_LCD_16 

'   Written by ANTON RIECKERT 
'   riecktron@tuks.co.za 
'   PORTC,0   -  CS   - Chip Enable 
'   PORTC,1   -  RES  - Reset Input 
'   PORTC,4   -  SCLK - Serial Clock Input 
'   PORTC,5   -  DC   - Data / Command 
'   PORTC,6   -  SDA  - Serial Data Input 
'   6x8 Font Table 
const font1 as byte[230] = 
(0x00, 0x00, 0x00, 0x00, 0x00 ,   '   space 
 0x00, 0x00, 0x2f, 0x00, 0x00 ,   '   ! 
 0x00, 0x07, 0x00, 0x07, 0x00 ,   '   " 
 0x14, 0x7f, 0x14, 0x7f, 0x14 ,   '   # 
 0x24, 0x2a, 0x7f, 0x2a, 0x12 ,   '   $ 
 0x62, 0x64, 0x08, 0x13, 0x23 ,   '   % 
 0x36, 0x49, 0x55, 0x22, 0x50 ,   '   & 
 0x00, 0x05, 0x03, 0x00, 0x00 ,   '   ' 
 0x00, 0x1c, 0x22, 0x41, 0x00 ,   '   ( 
 0x00, 0x41, 0x22, 0x1c, 0x00 ,   '   ) 
 0x14, 0x08, 0x3E, 0x08, 0x14 ,   '   * 
 0x08, 0x08, 0x3E, 0x08, 0x08 ,   '   + 
 0x00, 0x00, 0xA0, 0x60, 0x00 ,   '   , 
 0x08, 0x08, 0x08, 0x08, 0x08 ,   '   - 
 0x00, 0x60, 0x60, 0x00, 0x00 ,   '   . 
 0x20, 0x10, 0x08, 0x04, 0x02 ,   '   / 
 0x3E, 0x51, 0x49, 0x45, 0x3E ,   '   0 
 0x00, 0x42, 0x7F, 0x40, 0x00 ,   '   1 
 0x42, 0x61, 0x51, 0x49, 0x46 ,   '   2 
 0x21, 0x41, 0x45, 0x4B, 0x31 ,   '   3 
 0x18, 0x14, 0x12, 0x7F, 0x10 ,   '   4 
 0x27, 0x45, 0x45, 0x45, 0x39 ,   '   5 
 0x3C, 0x4A, 0x49, 0x49, 0x30 ,   '   6 
 0x01, 0x71, 0x09, 0x05, 0x03 ,   '   7 
 0x36, 0x49, 0x49, 0x49, 0x36 ,   '   8 
 0x06, 0x49, 0x49, 0x29, 0x1E ,   '   9 
 0x00, 0x36, 0x36, 0x00, 0x00 ,   '   : 
 0x00, 0x56, 0x36, 0x00, 0x00 , 
 0x08, 0x14, 0x22, 0x41, 0x00 ,   '   < 
 0x14, 0x14, 0x14, 0x14, 0x14 ,   '   = 
 0x00, 0x41, 0x22, 0x14, 0x08 ,   '   > 
 0x02, 0x01, 0x51, 0x09, 0x06 ,   '   ? 
 0x32, 0x49, 0x59, 0x51, 0x3E ,   '   @ 
 0x7C, 0x12, 0x11, 0x12, 0x7C ,   '   A 
 0x7F, 0x49, 0x49, 0x49, 0x36 ,   '   B 
 0x3E, 0x41, 0x41, 0x41, 0x22 ,   '   C 
 0x7F, 0x41, 0x41, 0x22, 0x1C ,   '   D 
 0x7F, 0x49, 0x49, 0x49, 0x41 ,   '   E 
 0x7F, 0x09, 0x09, 0x09, 0x01 ,   '   F 
 0x3E, 0x41, 0x49, 0x49, 0x7A ,   '   G 
 0x7F, 0x08, 0x08, 0x08, 0x7F ,   '   H 
 0x00, 0x41, 0x7F, 0x41, 0x00 ,   '   I 
 0x20, 0x40, 0x41, 0x3F, 0x01 ,   '   J 
 0x7F, 0x08, 0x14, 0x22, 0x41 ,   '   K 
 0x7F, 0x40, 0x40, 0x40, 0x40 ,   '   L 
 0x7F, 0x02, 0x0C, 0x02, 0x7F)    '   M 
  
 const font2 as byte[230] = 
(0x7F, 0x04, 0x08, 0x10, 0x7F ,   '   N 
 0x3E, 0x41, 0x41, 0x41, 0x3E ,   '   O 
 0x7F, 0x09, 0x09, 0x09, 0x06 ,   '   P 
 0x3E, 0x41, 0x51, 0x21, 0x5E ,   '   Q 
 0x7F, 0x09, 0x19, 0x29, 0x46 ,   '   R 
 0x46, 0x49, 0x49, 0x49, 0x31 ,   '   S 
 0x01, 0x01, 0x7F, 0x01, 0x01 ,   '   T 
 0x3F, 0x40, 0x40, 0x40, 0x3F ,   '   U 
 0x1F, 0x20, 0x40, 0x20, 0x1F ,   '   V 
 0x3F, 0x40, 0x38, 0x40, 0x3F ,   '   W 
 0x63, 0x14, 0x08, 0x14, 0x63 ,   '   X 
 0x07, 0x08, 0x70, 0x08, 0x07 ,   '   Y 
 0x61, 0x51, 0x49, 0x45, 0x43 ,   '   Z 
 0x00, 0x7F, 0x41, 0x41, 0x00 ,   '   [ 
 0x55, 0x2A, 0x55, 0x2A, 0x55 ,   '   / 
 0x00, 0x41, 0x41, 0x7F, 0x00 ,   '   ] 
 0x04, 0x02, 0x01, 0x02, 0x04 ,   '   ^ 
 0x40, 0x40, 0x40, 0x40, 0x40 ,   '   _ 
 0x00, 0x01, 0x02, 0x04, 0x00 ,   '   ' 
 0x20, 0x54, 0x54, 0x54, 0x78 ,   '   a 
 0x7F, 0x48, 0x44, 0x44, 0x38 ,   '   b 
 0x38, 0x44, 0x44, 0x44, 0x20 ,   '   c 
 0x38, 0x44, 0x44, 0x48, 0x7F ,   '   d 
 0x38, 0x54, 0x54, 0x54, 0x18 ,   '   e 
 0x08, 0x7E, 0x09, 0x01, 0x02 ,   '   f 
 0x18, 0xA4, 0xA4, 0xA4, 0x7C ,   '   g 
 0x7F, 0x08, 0x04, 0x04, 0x78 ,   '   h 
 0x00, 0x44, 0x7D, 0x40, 0x00 ,   '   i 
 0x40, 0x80, 0x84, 0x7D, 0x00 ,   '   j 
 0x7F, 0x10, 0x28, 0x44, 0x00 ,   '   k 
 0x00, 0x41, 0x7F, 0x40, 0x00 ,   '   l 
 0x7C, 0x04, 0x18, 0x04, 0x78 ,   '   m 
 0x7C, 0x08, 0x04, 0x04, 0x78 ,   '   n 
 0x38, 0x44, 0x44, 0x44, 0x38 ,   '   o 
 0xFC, 0x24, 0x24, 0x24, 0x18 ,   '   p 
 0x18, 0x24, 0x24, 0x18, 0xFC ,   '   q 
 0x7C, 0x08, 0x04, 0x04, 0x08 ,   '   r 
 0x48, 0x54, 0x54, 0x54, 0x20 ,   '   s 
 0x04, 0x3F, 0x44, 0x40, 0x20 ,   '   t 
 0x3C, 0x40, 0x40, 0x20, 0x7C ,   '   u 
 0x1C, 0x20, 0x40, 0x20, 0x1C ,   '   v 
 0x3C, 0x40, 0x30, 0x40, 0x3C ,   '   w 
 0x44, 0x28, 0x10, 0x28, 0x44 ,   '   x 
 0x1C, 0xA0, 0xA0, 0xA0, 0x7C ,   '   y 
 0x44, 0x64, 0x54, 0x4C, 0x44 ,   '   z 
 0x14, 0x14, 0x14, 0x14, 0x14)    '   horiz lines 


sub procedure NOK_Write (dim data as byte, dim mode as byte) 
dim i as short 
     '   Pull DC high for DATA or low for COMMAND 
     if TestBit(mode,0) = 1 then 
       SetBit(PortC,5) 
     end if 
     if TestBit(mode,0) = 0 then 
       ClearBit(PortC,5) 
     end if 

     ClearBit(PortC,0)                                    '   CS = low 

     '   Clock in 8 bits of data - Highst bit first 
     for i = 7 to 0 step -1 
          ClearBit(PortC,4)                               '   SCLK = low 
          if TestBit(Data,i) = 0 then 
            ClearBit(PortC,6)                             '   SDA = low 
          else 
            SetBit(PortC,6)                               '   SDA = high 
          end if 
          SetBit(PortC,4)                                 '   SCLK = high 
     next i 
    SetBit(PortC,0)                                       '   CS = high 
end sub 

'   Draws a character on screen at current possition 
sub procedure NOK_Chr(dim symlcd as byte) 
dim l as byte 
dim m as word 

      NOK_Write(0x00,1)           '   Space between characters 
      for l = 1 to 5 
           m = (symlcd - 32) 
           m = m * 5 
           m = m + l 
           m = m - 1 
           NOK_Write(Font1[m],1) 
      next l 
end sub 

'   Set the current position for data (0<= x <= 84,  0<= y <= 5) 
sub procedure NOK_GotoXY(dim x as byte, dim y as byte) 
dim n as byte 
dim o as byte 

     n = x 
     o = y 
     SetBit(n,7) 
     SetBit(o,6) 
     NOK_Write (o,0) 
     NOK_Write (n,0) 
end sub 

'   Inverts Display - Here is still a bug. It only inverst once and doesn't 
'   want to invert back again 
sub procedure NOK_Invert 
     NOK_Write(0x0D,0) 
end sub 

'   Clear the LCD Data memory 
sub procedure NOK_Clear 
dim p as byte 
dim q as byte 
dim r as byte 

     ClearBit(PortC,6)                    '   SDA = low - Data bit is low 
     SetBit(PortC,5)                      '   DC = high - Data mode 
     ClearBit(PortC,0)                    '   CS = low  - Chip Enable 

     for p = 1 to 6                       '    for 6 rows 
          for q = 1 to 84                 '    for 84 colums 
               for r = 1 to 8             '    for 8 loop (8 bits) 
                    ClearBit(PortC,4)     '    SCLK = low  - Serial Clock Input 
                    SetBit(PortC,4)       '    SCLK = high - Serial Clock Input 
               next r 
          next q 
     next p 
end sub 

'   Writes a string at x, y position (maks 14 char per row)  (0 <= x <= 84 , 0 <= y <= 5) 
sub procedure NOK_Out(dim x as byte, dim y as byte, 
                      dim byref sentance as char[14]) 
dim v as byte 
     NOK_GotoXY(x,y) 
     for v = 1 to length(sentance) 
          NOK_Chr(sentance[v]) 
     next v 
end sub 

'   LCD Initialization 
sub procedure NOK_Init 
     '   Set initial status of LCD pins 
     ClearBit(PortC,4)             '      SCLK = low 
     ClearBit(PortC,6)             '      SDA  = low 
     ClearBit(PortC,5)             '      DC   = low 
     ClearBit(PortC,0)             '      CS   = low 
     ClearBit(PortC,1)             '      RES  = low 

     '   Toggle LCD reset 
     Delay_ms(20) 
     ClearBit(PortC,1)        '       RES = low 
     Delay_ms(500) 
     SetBit(PortC,1)          '       RES = high 

     SetBit(PortC,0)          '       CS  = high 
     NOK_Write(0x21,0)        '       Extended commands 
     NOK_Write(0xc5,0)        '       LCD Vop 
     NOK_Write(0x06,0)        '       Temp coef 
     NOK_Write(0x13,0)        '       LCD Bias 1:48 
     NOK_Write(0x20,0)        '       Standard commands 
     NOK_Write(0x0c,0)        '       Normal Mode 

     '   Clear and position at top of LCD 
     NOK_Clear 
     NOK_GotoXY(0,0) 
end sub 

end.
Plz guide me which is the best way for doing this???
 
What you should be writing is a sub-routine, not a macro - a sub-routine is included ONCE in the program, and called as required. A macro is inserted in the program EVERYTIME it's used.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…