• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

need a help with interfacing lcd with pic16f877a in asm ?!

Status
Not open for further replies.

emb

Member
Hi All,,

I need to display the voltage at RA0 on LCD..

I tried the following code with 7 segments it worked fine .. the voltage at pin RA0 diplayed correctly on segments.

but when i tried to display the voltage on lcd no things displayed on it :(
ONLY THE LED CONNECTED ON RC0 BLINKING EVERY 1 SECOND

here is the code
Code:
PROCESSOR 16F877A
INCLUDE <P16F877A.INC>
 
__CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
 
;:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:*:
 
 
 
 
 

CNT EQU 0X20
ADhi EQU 31 ; Binary input high byte
ADlo EQU 32 ; Binary input low byte
thos EQU 33 ; Thousands digit in decimal
huns EQU 34 ; Hundreds digit in decimal value
tens EQU 35 ; Tens digit in decimal value
ones EQU 36 ; Ones digit in decimal value
ADL EQU 37
ADH EQU 38
D11 EQU 39
D2 EQU 40
D3 EQU 41
;START PROGRAM
ORG 0
GOTO MAIN
INCLUDE <LCD.INC>

MAIN:
;CONFIGURE I/O PINS
LCDINIT

BSF STATUS,RP0 ;SELECT BANK1 TO
BCF STATUS,RP1; ACCESS SFRs IN BANK1
BSF TRISA,0
BCF TRISC,0
MOVLW B'10000011'
MOVWF ADCON1
 
BCF STATUS,RP0 ;RETURN BACK TO BANK0
 

MOVLW B'11000001'
MOVWF ADCON0

BSF PORTC,0
 
BEGIN:
 
MOVLW 007 ; load counter
MOVWF CNT
LOOP
DECFSZ CNT ; and delay 20us
GOTO LOOP
 
BSF ADCON0,GO ; start ADC..
wait
BTFSC ADCON0,GO ; ..and wait for finish
GOTO wait
 
CALL CONV2D
 
MOVF thos,W
ADDLW 0X30
MOVWF W_REG
LCDDATA W_REG

MOVLW '.'
MOVWF W_REG
LCDDATA W_REG

MOVF huns,W
ADDLW 0X30
MOVWF W_REG
LCDDATA W_REG

MOVF tens,W
ADDLW 0X30
MOVWF W_REG
LCDDATA W_REG

MOVF ones,W
ADDLW 0X30
MOVWF W_REG
LCDDATA W_REG


MOVLW ' '
MOVWF W_REG
LCDDATA W_REG
MOVLW 'V'
MOVWF W_REG
LCDDATA W_REG
MOVLW 'O'
MOVWF W_REG
LCDDATA W_REG
MOVLW 'L'
MOVWF W_REG
LCDDATA W_REG
MOVLW 'T'
MOVWF W_REG
LCDDATA W_REG
MOVLW 's'
MOVWF W_REG
LCDDATA W_REG
BSF PORTC,0
CALL DELAY_SECOND
BCF PORTC,0
CALL DELAY_SECOND
LCDCMD _LCD_CLEAR ;CLEAR LCD
LCDSETCURSOR 1,2;MOVE CURSOR TO 1ST ROW
GOTO BEGIN
 
 
 
CONV2D:
MOVF ADRESH,W ; get ADC result
MOVWF ADhi ; high bits
BANKSEL ADRESL ; in bank 1
MOVF ADRESL,W ; get ADC result
BANKSEL ADRESH ; default bank 0
MOVWF ADlo ; low byte
; Multiply by 5 for result 0 - 5120 by shifting left 2 TIMES + THE ORIGINAL VALUE.........
BCF STATUS,C ; rotate 0 into LSB and
RLF ADlo ; shift low byte left
BTFSS STATUS,C ; carry out?
GOTO rot1 ; no, leave carry clear
BSF STATUS,C ; rotate 1 into LSB and
rot1
RLF ADhi ; shift high byte left
BCF STATUS,C ; rotate 0 into LSB
RLF ADlo ; rotate low byte left again
BTFSS STATUS,C ; carry out?
GOTO rot2 ; no, leave carry clear
BSF STATUS,C ; rotate 1 into LSB and
rot2
RLF ADhi ; shift high byte left
 
MOVF ADRESH,W ; get ADC result
MOVWF ADH ; high bits
BANKSEL ADRESL ; in bank 1
MOVF ADRESL,W ; get ADC result
BANKSEL ADRESH ; default bank 0
MOVWF ADL ; low byte
 
BCF STATUS,C
MOVF ADL,W
ADDWF ADlo,F
BTFSS STATUS,C
GOTO NC
MOVF ADH,W
ADDWF ADhi,W
ADDLW 0X01
MOVWF ADhi
GOTO HI
NC:
MOVF ADH,W
ADDWF ADhi,F
HI:
 
; Clear BCD registers........................................
clrbcd
CLRF thos ; zero thousands digit
CLRF huns ; zero hundreds digit
CLRF tens ; zero tens digit
CLRF ones ; zero ones digit
; Calclulate thousands low byte .............................
tholo
MOVF ADhi,F ; check high byte
BTFSC STATUS,Z ; high byte zero?
GOTO hunlo ; yes, next digit
BSF STATUS,C ; set carry for subtract
MOVLW 0E8 ; load low byte of 1000
SUBWF ADlo ; and subtract low byte
BTFSC STATUS,C ; borrow from high bits?
GOTO thohi ; no, do high byte
DECF ADhi ; yes, subtract borrow
; Calculate thousands high byte..............................
thohi
BSF STATUS,C ; set carry for subtract
MOVLW 003 ; load high byte of 1000
SUBWF ADhi ; subtract from high byte
BTFSC STATUS,C ; result negative?
GOTO incth ; no, inc digit and repeat
ADDWF ADhi ; yes, restore high byte
; Restore remainder when done ...............................
BCF STATUS,C ; clear carry for add
MOVLW 0E8 ; load low byte of 1000
ADDWF ADlo ; add to low byte
BTFSC STATUS,C ; carry out?
INCF ADhi ; yes, inc high byte
GOTO hunlo ; and do next digit
; Increment thousands digit and repeat.......................
incth
INCF thos ; inc digit
GOTO tholo ; and repeat
; Calclulate hundreds .......................................
hunlo
MOVLW 064 ; load 100
BSF STATUS,C ; set carry for subtract
SUBWF ADlo ; and subtract low byte
BTFSC STATUS,C ; result negative?
GOTO inch ; no, inc hundreds & repeat
MOVF ADhi,F ; yes, test high byte
BTFSC STATUS,Z ; zero?
GOTO remh ; yes, done
DECF ADhi ; no, subtract borrow
inch
INCF huns ; inc hundreds digit
GOTO hunlo ; and repeat
remh
ADDWF ADlo ; restore onto low byte
; Calculate tens digit......................................
subt
MOVLW D'10' ; load 10
BSF STATUS,C ; set carry for subtract
SUBWF ADlo ; and subtract from result
BTFSS STATUS,C ; and check if done
GOTO remt ; yes, restore remainder
INCF tens ; no, count number of loops
GOTO subt ; and repeat
; Restore remainder.........................................
remt
ADDWF ADlo ; yes, add 10 back on
MOVF ADlo,W ; load remainder
MOVWF ones ; and store as ones digit
RETURN ; done



;DELAY 1 SEC ROUTINE 4MHz oscillator
DELAY_SECOND:
MOVLW .5 ;.10==B'00000101' 8MHz OSC
MOVWF D3
LOOP3:
MOVLW .200 ;.200==B'11111111'
MOVWF D2
LOOP2:
MOVLW .200 ;.200==B'11111111'
MOVWF D11
LOOP1:
NOP
NOP
DECFSZ D11,F
GOTO LOOP1
DECFSZ D2,F
GOTO LOOP2
DECFSZ D3,F
GOTO LOOP3
RETURN

END

here is my lcd driver LCD.INC
Code:
#DEFINE LCD_PORT PORTD
#define LCD_RS PORTD,RD2
#define LCD_RW PORTD,RD1
#define LCD_EN PORTD,RD0
#define LCD_D4 PORTD,RD4
#define LCD_D5 PORTD,RD5
#define LCD_D6 PORTD,RD6
#define LCD_D7 PORTD,RD7
 
#define LCD_RS_Direction TRISD,RD2
#define LCD_RW_Direction TRISD,RD1
#define LCD_EN_Direction TRISD,RD0
#define LCD_D4_Direction TRISD,RD4
#define LCD_D5_Direction TRISD,RD5
#define LCD_D6_Direction TRISD,RD6
#define LCD_D7_Direction TRISD,RD7
 
 
 
#define _LCD_CLEAR 0X01
#define _LCD_RETURN_HOME 0X02
#define _LCD_CURSOR_OFF 0x0c
#define _LCD_CURSOR_ON 0X0E
#define _LCD_BLINK_CURSOR_ON 0X0F
#define _LCD_MOVE_CURSOR_LEFT 0X10
#define _LCD_MOVE_CURSOR_RIGHT 0X14
#define _LCD_TURN_ON 0X0C
#define _LCD_TURN_OFF 0X08
#define _LCD_SHIFT_LEFT 0X18
#define _LCD_SHIFT_RIGHT 0X1C
#define _LCD_BLINK_CURSOR_OFF 0X0E
 

CBLOCK 0x70
CNTA ;DELAY COUNTER A
CNTB ;DELAY COUNTER B
CNTC ;DELAY COUNTER C
LCDTEMP
W_REG
ENDC
 
 
 
 
 
 
 
LCDINIT MACRO
 

BSF STATUS,RP0 ;SELECT BANK1 TO
BCF STATUS,RP1; ACCESS SFRs IN BANK1
BCF LCD_D4_Direction
BCF LCD_D5_Direction
BCF LCD_D6_Direction
BCF LCD_D7_Direction
BCF LCD_RS_Direction
BCF LCD_RW_Direction
BCF LCD_EN_Direction

BCF STATUS,RP0 ;RETURN BACK TO BANK0
 
 
 

BCF LCD_RS
BCF LCD_EN
BCF LCD_RW

CALL DEL05 ;DO 5MS DELAY
CALL DEL05 ;DO 5MS DELAY
CALL DEL05 ;DO 5MS DELAY


lcdsnibble 0x03
CALL DEL05
lcdsnibble 0x03
CALL DEL05
lcdsnibble 0x03
CALL DEL05


lcdsnibble 0X02 ;// cmd: go into 4-bit mode (only MS 4bits connected)
CALL DEL05
LCDCMD 0x28 ; // 4-bit mode, 2lines, 5*7 matrix
LCDCMD 0x6 ; // enable display
LCDCMD 0xC ; // display ON, cursor & blink OFF
LCDCMD 0x1 ; // clear display, address counter to zero

CALL DEL100
 

ENDM
 
 
 
lcdsnibble MACRO nibble
 


;....................
BTFSC nibble,0
GOTO $+3
BCF LCD_PORT,4
GOTO $+2
BSF LCD_PORT,4
;....................
;....................
BTFSC nibble,1
GOTO $+3
BCF LCD_PORT,5
GOTO $+2
BSF LCD_PORT,5
;....................
;....................
BTFSC nibble,2
GOTO $+3
BCF LCD_PORT,6
GOTO $+2
BSF LCD_PORT,6
;;....................
;;..................
BTFSC nibble,3
GOTO $+3
BCF LCD_PORT,7
GOTO $+2
BSF LCD_PORT,7

NOP
BSF LCD_EN
NOP
NOP
BCF LCD_EN
 
ENDM
 
 
 
 
 

LCDDATA MACRO value



BCF LCD_RS
BANKSEL TRISD
BSF LCD_D7_Direction
BANKSEL PORTD
BTFSC LCD_D7
GOTO $-1
BANKSEL TRISD
BCF LCD_D7_Direction
BANKSEL PORTD

BSF LCD_RS ;data
NOP

BCF LCD_RW; ;write
NOP
BCF LCD_EN




SWAPF value,W
MOVWF LCDTEMP
MOVLW 0X0F
ANDWF LCDTEMP,F
lcdsnibble LCDTEMP

MOVF value,W
ANDLW 0X0F
MOVWF LCDTEMP
lcdsnibble LCDTEMP

ENDM
 

LCDCMD MACRO value
 
BCF LCD_RS
BSF STATUS,RP0 ;SELECT BANK1 TO
BCF STATUS,RP1; ACCESS SFRs IN BANK1
BSF LCD_D7_Direction
BSF STATUS,RP0 ;RETURN TO BANK0
BTFSC LCD_D7
GOTO $-1
BANKSEL TRISB
BCF LCD_D7_Direction
BANKSEL PORTB

BCF LCD_RS ;COMMAND
NOP

BCF LCD_RW; ;write
NOP
BCF LCD_EN




SWAPF value,W
MOVWF LCDTEMP
MOVLW 0X0F
ANDWF LCDTEMP,F
lcdsnibble LCDTEMP

MOVF value,W
ANDLW 0X0F
MOVWF LCDTEMP
lcdsnibble LCDTEMP


ENDM
 
 
 
LCDSETCURSOR MACRO x,y
 
;.................... ; if(y!=1)
DECFSZ y,W
GOTO YYT
GOTO YYT1
;.................... ; address=0x40;
YYT:
MOVLW 40
MOVWF LCDTEMP
GOTO YYT2
;.................... ; else
;.................... ; address=0;
 
YYT1:
CLRF LCDTEMP
;....................
;.................... ;address+=x-1;
YYT2:
MOVLW 01
SUBWF x,W
ADDWF LCDTEMP,F
;....................
;.................... ; address=0x80|address;
BSF LCDTEMP,7
LCDCMD LCDTEMP
 
ENDM
 
 

;DELAY ROUTINES
D16US:
CLRF CNTC
BSF CNTC, 5 ;DELAY 160US
BSF CNTC, 4
DECFSZ CNTC, F
GOTO $-1
RETURN

;SELECT DELAY TIME
DEL250:
MOVLW 0xFA ;DELAY 250MS
GOTO D0
DEL255:
MOVLW 0xFF ;DELAY 255MS
GOTO D0
DEL200:
MOVLW D'200' ;DELAY 200MS
GOTO D0
DEL100:
MOVLW D'100' ;DELAY 100MS
GOTO D0
DEL50:
MOVLW D'50' ;DELAY 50MS
GOTO D0
DEL20:
MOVLW D'20' ;DELAY 20MS
GOTO D0
DEL05:
MOVLW 0x05 ;DELAY 5.000MS (4 MHz clock)
GOTO D0
DEL01:
MOVLW 0x01 ;DELAY 1.000MS (4 MHz clock)
 
;DO SELECTED DELAY
D0:
MOVWF CNTC
D1:
MOVLW 0xC7 ;DELAY 1MS
MOVWF CNTA
MOVLW 0x01
MOVWF CNTB
DEL_0:
DECFSZ CNTA,F
GOTO $+2
DECFSZ CNTB,F
GOTO DEL_0
DECFSZ CNTC,F
GOTO D1
RETLW 0x00
regards
 
Last edited by a moderator:

Wp100

Well-Known Member
A lot of code to go though there ! :rolleyes:

You could try this proven 4mhz code which is in 4 bit mode so saving 4 data lines.
 

Attachments

Pommie

Well-Known Member
Most Helpful Member
Do you realize that using macros instead of subroutines will make your code huge?

Mike.
 

jpanhalt

Well-Known Member
Most Helpful Member
First off, thank you to the moderator who set the code in code tags. For the TS's information, that is done this way when using Microchip assembly:
[code=MPASM]<insert code>[/code]

I too wonder about the contrast.

John
 

Pommie

Well-Known Member
Most Helpful Member
First off, thank you to the moderator who set the code in code tags. For the TS's information, that is done this way when using Microchip assembly:
[code=MPASM]<insert code>[/code]

I too wonder about the contrast.

John
Thank you John. I knew in the past there was a noparse tag but that stopped working. Now, thanks to you, I know there is a plain tag. Good to know.

Mike.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
First off, thank you to the moderator who set the code in code tags. For the TS's information, that is done this way when using Microchip assembly:
The tags I just use is just" code=asm "... I Hate seeing tons of code it makes it unreadable...
FYI.. Wp100 it is 4 bit and I cannot find a software issue..
 

jpanhalt

Well-Known Member
Most Helpful Member
A macro simply repeats a series of steps as needed. With respect to code, it inserts all of the instructions each time it is invoked. A subroutine only inserts the call instruction inline with the rest of the code. Sure, a call and a return take 2 instruction cycles each (assuming you are not having to adjust pages), but that penalty is small compared to a macro that is, say, 4 instructions or more.

As for your LCD, if you turn up the contrast do you see the right number of dark rectangles, or is it just blank?

John
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
ORG 0
GOTO MAIN
INCLUDE <LCD.INC>
I would have to check, But this is probably NOT the best place to include an external file... This needs to be one of the first lines at the top...
 

emb

Member
A macro simply repeats a series of steps as needed. With respect to code, it inserts all of the instructions each time it is invoked. A subroutine only inserts the call instruction inline with the rest of the code. Sure, a call and a return take 2 instruction cycles each (assuming you are not having to adjust pages), but that penalty is small compared to a macro that is, say, 4 instructions or more.

As for your LCD, if you turn up the contrast do you see the right number of dark rectangles, or is it just blank?

John
thank you :)

dark rectangles >>>
 

emb

Member
i tried with gputils using geany editor compilation failed (no errors only messages)

when i used MPLAB IDE the code build successfully ,,, the blinking led blinks correctly every one second but nothing appears on lcd
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
The trouble is: You are defining all the macros in the LCD.inc but you have the delays as normal code... If you place the include after the label "MAIN" then the code jumps right into the delays.. If you place the include before "MAIN" Your code doesn't get to main as the delay causes an underflow of the stack and it reboots..

You will definitely need to re-write..

Grab the tutorial on Nigels web site ( link in my signature ) and swap your code in!!
 

jpanhalt

Well-Known Member
Most Helpful Member
I have not simulated the TS's code yet. So, I am not disagreeing with you, Ian.

However, when I am writing and debugging anything a little long, I will carve off several "includes" just to make it easier to scroll back and forth. For example this:
Code:
;*******************************************************************************
;START
     #include <Processor_Set-up.inc>  ;GIE is set
;*******************************************************************************
Main                          ;Creates spaceholder "Listening ......"
Of course, at the origin (0x00), I have a goto START, and START is the first label in that include file. The include file contains several lines of instructions, as does the TS's. If you put that include earlier, you get a lot of errors, including a lot of overwrite errors from the ISR at 0x0004.

So, I don't think that is the problem per se. Now, if his include were only defines and such with no instructions, then it could go very early.

BTW:I usually don't keep those include files later. It is just a tool I use to enhance readability for me. If I could "bookmark" and jump to those bookmarks easily in MPLAB 8.92, I wouldn't do it. The commented START is a placeholder for when I restore the include file to the inline code.

John
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
When I simulate the code "As is" the first line executed is the D16US routine which has a return!!

I haven't messed with asm for some time... Bits, but including external asm files not being one of them!!

I will find out why it barfs, BUT!!! a little too much whisky hic!* so it'll have to wait!
 

JimB

Super Moderator
Most Helpful Member
The problems as I see them:

1 The LCD.INC is sitting on top of the interrupt vector.
This may not be a problem if interrupts are not used, but sounds like a bad idea to me.
I would do this:
Code:
;START PROGRAM
ORG 0
GOTO MAIN
 
ORG 0x10
MAIN:
;CONFIGURE I/O PINS
LCDINIT
2 The include file starts with a whole load of definitions which it puts into the main body of the program, the definitions should be before the start of the program with all the other definitions.
If you want the LCD definitions as an include file, make a separate one for the definitions and include them in the appropriate place.

I usually put my include files after the end of the main body of the program, like this:
Code:
  List p=16F887, r=dec

 include "p16F887.inc"

#include <p16F887.inc>
 __CONFIG    _CONFIG1, _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
 __CONFIG    _CONFIG2, _WRT_OFF & _BOR21V


;Registers
 CBLOCK  0x20
  DELAY  
  X_DELAY  
  LCD_TEMP
  LCD_TEMP_1
  CHAR_COUNT  
  DISPLAY_BASE:0x20 ;32 display positions  
  RAW_ATTEN  ;1 byte to count the pulses from the quad
  RAW_FREQ
  
  ATTEN_DATA  ;data to send to the attenuator

  Scratch   ;Used by interupts and PIC initialisation
  STATUS_TEMP  ;Used by interupts
  W_TEMP   ;Used by interupts
  PCLATH_TEMP  ;Used by interupts
  BINARY_HI  ;Used by the binary to BCD converter
  BINARY_LO  ;
  BCD0                 ;MS BCD Digit
  BCD1    
  BCD2    
  BCD3                 ;LS BCD Digit

 ENDC

;I/O Port Aliases
Display  equ PORTD
Display_TRIS equ TRISD

LCD_DATA equ PORTD
LCD_DATA_TRIS equ TRISD

QUAD_port equ PORTB
QUAD_TRIS equ TRISB

ATTEN_PORT equ PORTC

;Constants
; PORTD LCD control bits
    
LCD_E  equ 3
LCD_RW  equ 2
LCD_RS  equ 1
;  equ 0




;*************************************************************************************

;Use this one for the attenuator

;PORTB    ;bits RB0 to RB1 will interupt on change
Quad_A   equ 0 ;Quad Encoder
Quad_B   equ 1 ;Quad Encoder
;   equ 2 ;set as output
FREQ_Select  equ 3 ;Frequency select switch
ATTEN_Select  equ 4 ;Attenuation select switch
;        equ 5 ;set as output
;        equ 6 ;set as output
;        equ 7 ;set as output


;***************************************************************************** 
 org 0
  goto  main_program
 org 04
  goto ServiceInterupts
main_program
  call  Initialise_PIC
  call LCD_init
  movlw 0x00 
  call  lcdsdda
  call lcdclear
  call lcdhome
  call    Clear_Line_1
  call    Clear_Line_2
  call write_to_lcd16x2  ;write to the LCD
  call    Initialise_Attenuator
main_loop
                call    Limit_Checking
                
                call    Write_to_Atten
  call  Bin2DecFast
  call Move_BCD_to_display_3
  call lcdhome
  call write_to_lcd16x2  ;write to the LCD

  sleep     ;wait for someting to happen

      goto main_loop   ;and go and do it all again

;*****************************************************************************  
Move_BCD_to_display_3

  movlw ' '
  movwf DISPLAY_BASE+6
  movlw ' '
  movwf DISPLAY_BASE+7
  movlw ' '
  movwf DISPLAY_BASE+8
;  movf BCD3, W
;  addlw 0x30    ;convert to ASCII
;  movwf DISPLAY_BASE+7
  movf BCD2, W
  addlw 0x30    ;convert to ASCII
  movwf DISPLAY_BASE+9
  movf BCD1, W
  addlw 0x30    ;convert to ASCII
  movwf DISPLAY_BASE+10
  movf BCD0, W
  addlw 0x30    ;convert to ASCII
  movwf DISPLAY_BASE+11
  movlw ' '
  movwf DISPLAY_BASE+12
  movlw 'd'
  movwf DISPLAY_BASE+13
  movlw 'B'
  movwf DISPLAY_BASE+14
  movlw ' '
  movwf DISPLAY_BASE+15
  return

;*****************************************************************************

                #include <Attenuator_Routines.inc>
         #include <Interupt_Routines_2.inc>
  #include <LCD_Routines.inc>
  #include <Initialisations.inc>
  #include <BIN_12bit_to_BCD.inc>

 end
Note, this is not a finished piece of work, just a quick test of a digitally controlled RF attenuator module.

JimB
 

jpanhalt

Well-Known Member
Most Helpful Member
Perhaps, I was misunderstood. My point was simply that failure of the TS's code was probably not due to unusual formatting or fragmenting by use of macros. Of course, until the cause of the failure is identified, we won't know.

To the point about formatting, macros, defines, equates and such are assembler instructions/directives. They don't appear in the code (sit on top of?) until invoked. I know both of you (Ian and JimB) know how they look in a disassembly, but I suspect the TS doesn't based on his comment re. macros. So, here are some examples:

upload_2017-11-20_4-45-27.png
Note the #includes are not part of the actual code (left side) at this point. Here is how a macro appears:

upload_2017-11-20_4-48-24.png
The code on the left is the macro "DelayCy" that is expanded and inserted when and only when it is invoked. It does not even appear in the clear space (above).

As for the TS, it might be easier and quicker to provide working 4-bit initialization for that LCD than trying to unravel his program that seems to interweave the ADC and LCD. He needs to give input on that.

John
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top