Continue to Site

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.

  • 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.

Pic12F683 LCD question

Status
Not open for further replies.
No worries--I'm learning right now too :D I started learning ASM quite a while back, but I quickly turned to C. The tutorials at **broken link removed** helped me a lot, and they may help you too. I posted a link to the tutorial with data tables in my edit of post #38

thanks for the help :) i didn't see the link befor i posted my last post but i'm going to take a look at the page ASAP . :)
 
Last edited:
thanks for the help :) i didn't see the link befor i posted my last post but i'm going to take a look at the page ASAP . :)

Haha, no problem. Your post came over while I was putting in the edit. Good luck! I hope it helps :)
 
Haha, no problem. Your post came over while I was putting in the edit. Good luck! I hope it helps :)

I hada look at the page and i just have to google a little bit anyway i thing you got me on the right track :)

i will continue reading and trying to get a working code later to day but first some sleep ( time is 00:15 )

i will keep you updated on the progress :)
 
i have a little porblem . i'm running the LCD in 4 bit mode according to the setup on the page i have linked to the problem is that the code i'm using is sending 8 bit ..what i need is to alter it so it send the high nybbles first then the lower nybles last..

This is the code i'm trying out ...
Code:
ser_out:    		
	movwf    sendreg           ;save copy of number
   movlw    0x08                ; load count for 8 bits
   movwf    count
 
testbit:       
	bcf   GPIO,0             ; clear bit (default)
   btfsc sendreg,7           ;7 test upper bit
   
   bsf  GPIO,0              ; set bit
 
clock:         
	bcf    GPIO,2
   nop                              ; send clock pulse
   
   bsf    GPIO,2
 
roflt:        
	rlf     sendreg,f              ; shift left
   decfsz  count,f                 ; decrement bit
 goto      testbit                             ; next bit
  	bcf    GPIO,2
   nop                                 ; extra clock pulse if
   bsf    GPIO,2                 ; clocks are tied

question is how do i split the data into 2x4 bit ???
 
Hi Lurkepus,
I would suggest you go check out Nigel's tutorials as I do think it is the best way to get your feet wet in using assembly. In the LCD tutorial there are the routines for doing just what you need. Also it would be more helpful if you put the full code in not just snippets then we can get the full picture. On a personal note I did start in ASM then found Oshonsoft Basic and I have found that to much easier to use and having the simulator and Eric's external modules does make for one complete learning tool.

Regards Bryan
 
Hi Lurkepus,
I would suggest you go check out Nigel's tutorials as I do think it is the best way to get your feet wet in using assembly. In the LCD tutorial there are the routines for doing just what you need. Also it would be more helpful if you put the full code in not just snippets then we can get the full picture. On a personal note I did start in ASM then found Oshonsoft Basic and I have found that to much easier to use and having the simulator and Eric's external modules does make for one complete learning tool.

Regards Bryan

Thanks for the Reply Bryan :)

This is the complete code
Code:
list	p=12f683		; list directive to define processor

#include <p12F683.inc>

     __config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _IESO_OFF & _FCMEN_OFF)

;
;*************** cblock Variabler ************************************
		cblock 0x20
Temp		;Temp variabel	
	d1
	d2
	d3
	sendreg
	count
	endc
;*********************Register oppsett********************************
		org 0 ;Flash start adresse 0
Start:
		bsf 	STATUS,RP0 ;Bank 1
		movlw 0x47
		movwf OSCCON ;4 MHZ oscilator  (0x70 = 8 MHZ)
		clrf 	TRISIO ; ALLE I/O porter =output 
		clrf	ANSEL	 ; Alle I/O porter =digital
		bcf	STATUS,RP0 ;Bank 0
;********************HOVED PROGRAMM ************************************
Main:
	bsf GPIO,1
	clrf sendreg
	movlw 0x20 	; LCD startup
	movwf sendreg
	call ser_out
	nop
	nop
	nop
	movlw 0x20
	movwf sendreg
	call ser_out
	nop
	nop
	nop
	
	movlw 0x20
	movwf sendreg
	call ser_out
	nop
	nop
	nop
	
	movlw 0x28
	movwf sendreg
	call ser_out
	nop
	nop
	
		movlw 0xc
	movwf sendreg
	call ser_out
	nop
	nop
	
		movlw 0x06
	movwf sendreg
	call ser_out
	nop
	nop
	
		movlw 0x01
	movwf sendreg
	call ser_out
	nop
	nop
Data_out:
	bcf GPIO,1
	clrf sendreg
	movlw 'a'
	movwf sendreg
	call	ser_out
	
	
	movlw  'w'
	movwf sendreg
	call ser_out
	
	movlw 's'
	movwf sendreg
	call ser_out
	
	movlw 'f'
	movwf sendreg
	call ser_out
	
	movlw 'G'
	movwf sendreg
	call ser_out
   
   movlw 'H'
	movwf sendreg
	call ser_out

	goto Main
		
		
		
ser_out:    		
	movwf    sendreg           ;save copy of number
   movlw    0x08               ; load count for 8 bits
   movwf    count
 
testbit:       
	bcf   GPIO,0             ; clear bit (default)
   btfsc sendreg,7          ;7 test upper bit
   
   bsf  GPIO,0              ; set bit
 
clock:         
	bcf    GPIO,2
   nop                              ; send clock pulse
   
   bsf    GPIO,2
 
roflt:        
	rlf     sendreg,f              ; shift left
   decfsz  count,f                 ; decrement bit
 goto      testbit                             ; next bit
  	bcf    GPIO,2
   nop                                 ; extra clock pulse if
   bsf    GPIO,2                 ; clocks are tied
   

		end



I have been readin so much turtorials and datasheets that my head still is spinning LOL but i start to get the hang of things and i'm learning new things just by reding the same stuff for the 100th time :)

i will look into other languages but besides learning totaly new stuff i have to learn the high level languag formating of the code.. that is one reason i startet with assembly :)

i also learn alot by reading code and trying it out but it looks like most ppl are using C or basic , anyway i'm trying out stuff by writing my own code and running it trough MPlab sim then i can see how the various commands affect registers and stuff . :)

btw do you have a link to Nigel's LCD tutorial ??
 
Last edited:
btw do you have a link to Nigel's LCD tutorial ??

This is the main page. I think Tutorial 3 is the one you want for the LCD.



Der Strom
 
i have been writing and testing some code but the problem is that i have to send 4 bit ( Hi and Low nybble ) and i haven't been able to figure how.. i hope someone can help me out ..
 
I did start in ASM then found Oshonsoft Basic and I have found that to much easier to use and having the simulator and Eric's external modules does make for one complete learning tool.

Regards Bryan
I had a look at the Oshonsoft Basic only problem is that i don't have any pc running winshit all my comps are using linux Mplab is running under wine and i'm using PicProg to burn the chip ..
 
I threw something together last week (below) but my work load at university has kept me from simulating it, let alone finding time to breadboard a circuit, so this may not be much help. My apologies Sir...

Regards, Mike

Code:
;******************************************************************
;                                                                 *
;   Filename: 12F683 595 LCD RB.asm                               *
;     Author: Mike McLaren, K8LH                                  *
;       Date: 03-Nov-11                                           *
;                                                                 *
;                                                                 *
;   Raj Bhatt's 12F683 + 74HC595 + LCD Circuit Experiment         *
;                                                                 *
;      MPLab: 8.80    (tabs = 8)                                  *
;      MPAsm: 5.43                                                *
;                                                                 *
;******************************************************************

        processor PIC12F683
        include "P12F683.inc"
        list    st=off          ; suppress LST file symbol table
        errorlevel -302         ; suppress bank warning messages
        radix   dec

        __CONFIG _MCLRE_OFF & _WDT_OFF & _INTOSCIO
;
;  variables
;
        cblock  0x20
work                            ; low level lcd work variable
delayhi                         ; DelayCy() work variable
        endc
;
;  defines
;
#define clk_pin GPIO,1          ; to 74HC595 CLK & LAT pins
#define dat_pin GPIO,5          ; to 74HC595 DAT pin
#define ena_pin GPIO,2          ; to LCD 'E' pin

;******************************************************************
;  K8LH DelayCy() subsystem macro generates four instructions     *
;******************************************************************
        radix   dec
clock   equ     8               ; 4, 8, 12, 16, 20 (MHz), etc.
usecs   equ     clock/4         ; cycles/microsecond multiplier
msecs   equ     clock/4*1000    ; cycles/millisecond multiplier

DelayCy macro   delay           ; 11..327690 cycle range
        movlw   high((delay-11)/5)+1
        movwf   delayhi
        movlw   low ((delay-11)/5)
        call    uDelay-((delay-11)%5)
        endm

;******************************************************************
;  reset vector                                                   *
;******************************************************************
        org     0x0000
v_reset
        clrf    STATUS          ; force bank 0, IRP = 0           |B0
        goto    init            ;                                 |B0

;******************************************************************
;  interrupt vector                                               *
;******************************************************************
        org     0x0004
v_int

;******************************************************************
;  subroutines                                                    *
;******************************************************************

PutCMD
        clrc                    ; C = RS = 0 (command)            |B0
        skpnc                   ; skip                            |B0
PutDAT
        setc                    ; C = RS = 1 (data)               |B0
        movwf   work            ; save data                       |B0
        call    PutNyb          ; send hi nybble                  |B0
        swapf   work,F          ;                                 |B0
        call    PutNyb          ; send lo nybble                  |B0
        DelayCy(40*usecs)       ; 40 us inter-char delay          |B0
        return                  ;                                 |B0
;
;  shift out RS bit, the hi nibble bits, and one extra clock
;
PutNyb
        bcf     dat_pin         ; dat = 0                         |B0
        skpnc                   ; RS = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1 (strobe clk)            |B0
        bcf     clk_pin         ; clk = 0                         |B0
b7      bcf     dat_pin         ; dat = 0                         |B0
        btfsc   work,7          ; b7 = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1                         |B0
        bcf     clk_pin         ; clk = 0                         |B0
b6      bcf     dat_pin         ; dat = 0                         |B0
        btfsc   work,6          ; b6 = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1                         |B0
        bcf     clk_pin         ; clk = 0                         |B0
b5      bcf     dat_pin         ; dat = 0                         |B0
        btfsc   work,5          ; b5 = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1                         |B0
        bcf     clk_pin         ; clk = 0                         |B0
b4      bcf     dat_pin         ; dat = 0                         |B0
        btfsc   work,4          ; b4 = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1                         |B0
        bcf     clk_pin         ; clk = 0                         |B0
        bsf     clk_pin         ; clk = 1  (extra clock)          |B0
        bcf     clk_pin         ; clk = 0                         |B0
        bsf     ena_pin         ; ena = 1  (strobe data)          |B0
        bcf     ena_pin         ; ena = 0                         |B0
        return                  ;                                 |B0

;******************************************************************
;  K8LH DelayCy() 16-bit uDelay (11..327690 cycle) subroutine     *
;                                                                 *
        nop                     ; entry for (delay-11)%5 == 4     |B0
        nop                     ; entry for (delay-11)%5 == 3     |B0
        nop                     ; entry for (delay-11)%5 == 2     |B0
        nop                     ; entry for (delay-11)%5 == 1     |B0
uDelay  addlw   -1              ; subtract 5 cycle loop time      |B0
        skpc                    ; borrow? no, skip, else          |B0
        decfsz  delayhi,F       ; done?  yes, skip, else          |B0
        goto    uDelay          ; do another loop                 |B0
        return                  ;                                 |B0

;******************************************************************
;  main.init                                                      *
;******************************************************************
;
;  void main()                  //
;  {                            //
;    cmcon0 = 7;                // comparator off, digital I/O
;    osccon = 0x70;             // setup INTOSC for 8-MHz
;    while(osccon.HTS == 0);    // wait for osc 'stable' flag
;    trisio = 0b00001000;       // GP3 input, others outputs
;    gpio = 0;                  // clear all output latches
;    
init
        movlw   7               ;                                 |B0
        movwf   CMCON0          ; comparator off, digital I/O     |B0
        bsf     STATUS,RP0      ; bank 1                          |B1
        clrf    ANSEL           ; analog ADC off, digital I/O     |B1
        movlw   0x70            ;                                 |B1
        movwf   OSCCON          ; setup INTOSC = 8-MHz            |B1
stable
        btfss   OSCCON,HTS      ; osc stable? yes, skip, else     |B1
        goto    stable          ;                                 |B1
        movlw   b'00001000'     ;                                 |B1
        movwf   TRISIO          ; GP3 input, others outputs       |B1
        bcf     STATUS,RP0      ; bank 0                          |B0
        clrf    GPIO            ; set all output latches low      |B0
;
;  //
;  //  initialize HD44780 display in 4-bit interface mode
;  //
;    delay_ms(100);             // 100 msec LCD 'power up' reset
;    PutNyb(0x20);              // hi nibble of "4-bit" command
;    PutCMD(0x28);              // 4-bit, 2-lines, 5x7 font
;    PutCMD(0x08);              // display, cursor, blink all off
;    PutCMD(0x01);              // clear display
;    delay_us(1530);            // required 1.53 msec delay
;    PutCMD(0x06);              // cursor inc, shift off
;    PutCMD(0xC0);              // display on, leave cursor off
;    
        DelayCy(100*msecs)      ; 100-msec LCD 'power up' reset   |B0
        movlw   0x20            ; hi nybble of "4-bit" command    |B0
        call    PutNyb          ; set "4-bit interface" mode      |B0
        movlw   0x28            ; 4-bit, 2-lines, 5x7 font        |B0
        call    PutCMD          ; send "function set" command     |B0
        movlw   0x08            ; display, cursor, blink all off  |B0
        call    PutCMD          ; send "display on/off" command   |B0
        movlw   0x01            ; clear display (1.53-msecs)      |B0
        call    PutCMD          ; send "entry mode set" command   |B0
        DelayCy(1530*usecs)     ; 1.53 msec delay for "clear"     |B0
        movlw   0x06            ; cursor inc, shift off           |B0
        call    PutCMD          ; send "entry mode set" command   |B0
        movlw   0xC0            ; display on, leave cursor off    |B0
        call    PutCMD          ; send "display on/off" command   |B0
;
        movlw   'H'             ; print "hello world"             |B0
        call    PutDAT          ; send 'H'                        |B0
        movlw   'e'             ;                                 |B0
        call    PutDAT          ; send 'e'                        |B0
        movlw   'l'             ;                                 |B0
        call    PutDAT          ; send 'l'                        |B0
        movlw   'l'             ;                                 |B0
        call    PutDAT          ; send 'l'                        |B0
        movlw   'o'             ;                                 |B0
        call    PutDAT          ; send 'o'                        |B0
        movlw   ' '             ;                                 |B0
        call    PutDAT          ; send ' '                        |B0
        movlw   'W'             ;                                 |B0
        call    PutDAT          ; send 'W'                        |B0
        movlw   'o'             ;                                 |B0
        call    PutDAT          ; send 'o'                        |B0
        movlw   'r'             ;                                 |B0
        call    PutDAT          ; send 'r'                        |B0
        movlw   'l'             ;                                 |B0
        call    PutDAT          ; send 'l'                        |B0
        movlw   'd'             ;                                 |B0
        call    PutDAT          ; send 'd'                        |B0

loop    goto    loop            ; loop forever                    |B0

;******************************************************************
        end
 
Last edited:
Hi Mike thanks for helping me out :) I have run it trough MPlab sim and i just had to alter a few lines in the code before it worked .

i commented out 2 lines in the stable part since it was just looping
Code:
stable
        ;btfss   OSCCON,HTS      ; osc stable? yes, skip, else     |B1
        ;goto    stable          ;                                 |B1

same for this delay routine

Code:
uDelay  ;addlw   -1              ; subtract 5 cycle loop time      |B0
        ;skpc                    ; borrow? no, skip, else          |B0
        decfsz  delayhi,f       ; done?  yes, skip, else          |B0

I will try it on a breadboard and see if the code is working :)

Stig AkA Lurkepus
 
Last edited:
Hi Stig,

I'm very happy to hear you're using the simulator. You're correct in that the simulator will not provide the HTS (frequency stable) bit so I usually single step up to the "goto stable" instruction and then <right click> on the following instruction and select the <set PC to cursor> option from the pop-up menu in order to move on.

As far as the delay subsystem, I usually insert a break point on the the first instruction following any "DelayCy()" instruction and simply use the <run> command to quickly get past the tedious delay code and then I resume single stepping.

Good luck on your project...

Cheerful regards, Mike
 
Last edited:
Just wanted to mention that there are alternatives for the 3-pin interface you're building which may have advantages in one way or another...

Cheerful regards, Mike

74hc595-8-bit-interface-png.58547


74hc595-4-bit-interface-png.58548



**broken link removed**
 

Attachments

  • 74HC595 8-bit Interface.png
    74HC595 8-bit Interface.png
    17.1 KB · Views: 1,129
  • 74HC595 4-bit Interface.png
    74HC595 4-bit Interface.png
    36.9 KB · Views: 434
Last edited:
Hi Mike thanks for the help with the code :) I did try to rewire the breadboard (usnig the solderless typ ) but i think i might have a problem with the connections . I think i will design a pcb for the project and send it of to http://iteadstudio.com for production .. anywa i will try the breadboard again :)
 
Hi Stig,

I finally got a chance to simulate that program and found a mistake in the PutLCD routines... Updated program listing below...

Regards, Mike

Code:
;******************************************************************
;                                                                 *
;   Filename: 12F683 595 LCD RB.asm                               *
;     Author: Mike McLaren, K8LH                                  *
;       Date: 03-Nov-11  revised 16-Nov-11                        *
;                                                                 *
;                                                                 *
;   Raj Bhatt's 12F683 + 74HC595 + LCD Circuit Experiment         *
;                                                                 *
;      MPLab: 8.80    (tabs = 8)                                  *
;      MPAsm: 5.43                                                *
;                                                                 *
;******************************************************************

        processor PIC12F683
        include "P12F683.inc"
        list    st=off          ; suppress LST file symbol table
        errorlevel -302         ; suppress bank warning messages
        radix   dec

        __CONFIG _MCLRE_OFF & _WDT_OFF & _INTOSCIO
;
;  variables
;
        cblock  0x20
work                            ; low level lcd work variable
delayhi                         ; DelayCy() work variable
        endc
;
;  defines
;
#define clk_pin GPIO,1          ; to 74HC595 CLK & LAT pins
#define dat_pin GPIO,5          ; to 74HC595 DAT pin
#define ena_pin GPIO,2          ; to LCD 'E' pin

;******************************************************************
;  K8LH DelayCy() subsystem macro generates four instructions     *
;******************************************************************
        radix   dec
clock   equ     8               ; 4, 8, 12, 16, 20 (MHz), etc.
usecs   equ     clock/4         ; cycles/microsecond multiplier
msecs   equ     clock/4*1000    ; cycles/millisecond multiplier

DelayCy macro   delay           ; 11..327690 cycle range
        movlw   high((delay-11)/5)+1
        movwf   delayhi
        movlw   low ((delay-11)/5)
        call    uDelay-((delay-11)%5)
        endm

;******************************************************************
;  reset vector                                                   *
;******************************************************************
        org     0x0000
v_reset
        clrf    STATUS          ; force bank 0, IRP = 0           |B0
        goto    init            ;                                 |B0

;******************************************************************
;  interrupt vector                                               *
;******************************************************************
        org     0x0004
v_int

;******************************************************************
;  subroutines                                                    *
;******************************************************************

PutCMD
        clrc                    ; C = RS = 0 (command)            |B0
        skpnc                   ; skip                            |B0
PutDAT
        setc                    ; C = RS = 1 (data)               |B0
        call    shiftout        ; send hi nybble                  |B0
        swapf   work,W          ;                                 |B0
PutNyb
        call    shiftout        ; send lo nybble                  |B0
        DelayCy(40*usecs)       ; 40 us inter-char delay          |B0
        return                  ;                                 |B0
;
;  shift out RS bit, the hi nibble bits, and one extra clock
;
shiftout
        movwf   work            ; update work variable            |B0
        bcf     dat_pin         ; dat = 0                         |B0
        skpnc                   ; RS = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1 (strobe clk)            |B0
        bcf     clk_pin         ; clk = 0                         |B0
b7      bcf     dat_pin         ; dat = 0                         |B0
        btfsc   work,7          ; b7 = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1                         |B0
        bcf     clk_pin         ; clk = 0                         |B0
b6      bcf     dat_pin         ; dat = 0                         |B0
        btfsc   work,6          ; b6 = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1                         |B0
        bcf     clk_pin         ; clk = 0                         |B0
b5      bcf     dat_pin         ; dat = 0                         |B0
        btfsc   work,5          ; b5 = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1                         |B0
        bcf     clk_pin         ; clk = 0                         |B0
b4      bcf     dat_pin         ; dat = 0                         |B0
        btfsc   work,4          ; b4 = 1? no, skip, else          |B0
        bsf     dat_pin         ; dat = 1                         |B0
        bsf     clk_pin         ; clk = 1                         |B0
        bcf     clk_pin         ; clk = 0                         |B0
        bsf     clk_pin         ; clk = 1  (extra clock)          |B0
        bcf     clk_pin         ; clk = 0                         |B0
        bsf     ena_pin         ; ena = 1  (strobe data)          |B0
        bcf     ena_pin         ; ena = 0                         |B0
        return                  ;                                 |B0

;******************************************************************
;  K8LH DelayCy() 16-bit uDelay (11..327690 cycle) subroutine     *
;                                                                 *
        nop                     ; entry for (delay-11)%5 == 4     |B0
        nop                     ; entry for (delay-11)%5 == 3     |B0
        nop                     ; entry for (delay-11)%5 == 2     |B0
        nop                     ; entry for (delay-11)%5 == 1     |B0
uDelay  addlw   -1              ; subtract 5 cycle loop time      |B0
        skpc                    ; borrow? no, skip, else          |B0
        decfsz  delayhi,F       ; done?  yes, skip, else          |B0
        goto    uDelay          ; do another loop                 |B0
        return                  ; C = 0                           |B0

;******************************************************************
;  main.init                                                      *
;******************************************************************
;
;  void main()                  //
;  {                            //
;    cmcon0 = 7;                // comparator off, digital I/O
;    osccon = 0x70;             // setup INTOSC for 8-MHz
;    while(osccon.HTS == 0);    // wait for osc 'stable' flag
;    trisio = 0b00001000;       // GP3 input, others outputs
;    gpio = 0;                  // clear all output latches
;    
init
        movlw   7               ;                                 |B0
        movwf   CMCON0          ; comparator off, digital I/O     |B0
        bsf     STATUS,RP0      ; bank 1                          |B1
        clrf    ANSEL           ; analog ADC off, digital I/O     |B1
        movlw   0x70            ;                                 |B1
        movwf   OSCCON          ; setup INTOSC = 8-MHz            |B1
stable
        btfss   OSCCON,HTS      ; osc stable? yes, skip, else     |B1
        goto    stable          ;                                 |B1
        movlw   b'00001000'     ;                                 |B1
        movwf   TRISIO          ; GP3 input, others outputs       |B1
        bcf     STATUS,RP0      ; bank 0                          |B0
        clrf    GPIO            ; set all output latches low      |B0
;
;  //
;  //  initialize HD44780 display in 4-bit interface mode
;  //
;    delay_ms(100);             // 100 msec LCD 'power up' reset
;    PutNyb(0x20);              // hi nibble of "4-bit" command
;    PutCMD(0x28);              // 4-bit, 2-lines, 5x7 font
;    PutCMD(0x08);              // display, cursor, blink all off
;    PutCMD(0x01);              // clear display
;    delay_us(1530);            // required 1.53 msec delay
;    PutCMD(0x06);              // cursor inc, shift off
;    PutCMD(0xC0);              // display on, leave cursor off
;
        DelayCy(100*msecs)      ; 100-msec LCD 'power up' reset   |B0
        movlw   0x20            ; hi nybble of "4-bit" command    |B0
        call    PutNyb          ; set "4-bit interface" mode      |B0
        movlw   0x28            ; 4-bit, 2-lines, 5x7 font        |B0
        call    PutCMD          ; send "function set" command     |B0
        movlw   0x08            ; display, cursor, blink all off  |B0
        call    PutCMD          ; send "display on/off" command   |B0
        movlw   0x01            ; clear display (1.53-msecs)      |B0
        call    PutCMD          ; send "entry mode set" command   |B0
        DelayCy(1530*usecs)     ; 1.53 msec delay for "clear"     |B0
        movlw   0x06            ; cursor inc, shift off           |B0
        call    PutCMD          ; send "entry mode set" command   |B0
        movlw   0xC0            ; display on, leave cursor off    |B0
        call    PutCMD          ; send "display on/off" command   |B0
;
        movlw   'H'             ; print "hello world"             |B0
        call    PutDAT          ; send 'H'                        |B0
        movlw   'e'             ;                                 |B0
        call    PutDAT          ; send 'e'                        |B0
        movlw   'l'             ;                                 |B0
        call    PutDAT          ; send 'l'                        |B0
        movlw   'l'             ;                                 |B0
        call    PutDAT          ; send 'l'                        |B0
        movlw   'o'             ;                                 |B0
        call    PutDAT          ; send 'o'                        |B0
        movlw   ' '             ;                                 |B0
        call    PutDAT          ; send ' '                        |B0
        movlw   'W'             ;                                 |B0
        call    PutDAT          ; send 'W'                        |B0
        movlw   'o'             ;                                 |B0
        call    PutDAT          ; send 'o'                        |B0
        movlw   'r'             ;                                 |B0
        call    PutDAT          ; send 'r'                        |B0
        movlw   'l'             ;                                 |B0
        call    PutDAT          ; send 'l'                        |B0
        movlw   'd'             ;                                 |B0
        call    PutDAT          ; send 'd'                        |B0

loop    goto    loop            ; loop forever                    |B0

;******************************************************************
        end
 
Last edited:
i did a rewire of my breadboard setup and when i did thest it the LM7805 got really hot acctually it got so hot that i got a burnmark on my finger when i touched it (i was just checking that it had a good connection ) i really hope i didn't frye the LCDanyway they are cheap on ebay so i guess i have to order a new one just to make sure i got one working. last setup on my breadboard didn't make the regulator hot at all and the only difference (besides me probably having hooking the wires wrong that is ) is that i have attached the backlight usin a resistor on the postiv terminal of the LCD ..
 
Last edited:
Hi Stig,

Sorry to hear about you burning up the circuit... I hope to get some time these next few days to wire something up...

Regards, Mike
 
I have orderd 2 new LCD's of Ebay so i hope to have em her in a week or 2 . I did remove the LCD and replaced it with 4 LED's and the 7805 didn't heat up at all.. Sadly there were no smoke or flames when i managed to frye the LCD :( oh well i just have to wait for the new LCD's :)


Mike

Let me know how it worked out :)
 
Sorry you have to wait for LCDs...

I finally started building a prototype board yesterday for the 8 pin, 14 pin, and 20 pin "enhanced" mid-range PICs (which all share a common pin/port architecture). I'm using a cheapie phenolic 1.8" x 2.8" Radio Shack prototype board with a homemade paper silkscreen. When I finish wiring it up I'll throw a 12F683 in it and breadboard a 74HC595 and LCD in order to test that LCD software (probably next week during the Holiday).

Cheerful regards, Mike

k8lh-pcb-silkscreen-png.58598
 

Attachments

  • K8LH PCB Silkscreen.png
    K8LH PCB Silkscreen.png
    309.1 KB · Views: 349
  • K8LH PCB Silk.png
    K8LH PCB Silk.png
    62.1 KB · Views: 177
Last edited:
looks like a nice setup Mike :) i'm also about to design a circuit for the 683 but i'm using gEDA and mail the gerber files to iteadstudio .. it takes a few weeks to get the boards but it is sure worth waiting for :) the cheapest boards are 2X2 inches ( 9.90 +4 dollar PP) .. i usually get 12 pcb's.

I also notice that you have a ICSP header . how do you isolate it from rest of the circuit ?

another question i have .. Is it possble to have more than one button connected to a singel input on the 683 ? i was thing about adding 4 buttons and maybe usinge a voltage divider for each of em and do the rest in software.. can it be done that way ?

looking forward to see the result of your test :)

Regards
Stig
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top