LCD serial backpacks


Closed Thread
Results 1 to 40 of 68

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    33

    Default

    Well, beautiful. I comment out the 3 wsaves and everything came out as planned. I tested the 628 on my breadboard and the led blinked as expected. After that triumph I load your Serialin (I called Parallel to Serial) program and compiled it. I got one error only
    “Error [118] C:\program~1\mecanic~1\mcs\parallel~3 asm 200:Overwriting previous address contents(2007)” As always I try to find that error on the posts and I did but I don’t understand how to fix it. Thanks.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Quote Originally Posted by timseven View Post
    I got one error only
    “Error [118] C:\program~1\mecanic~1\mcs\parallel~3 asm 200:Overwriting previous address contents(2007)”
    I think you've found just about every possible problem.

    With the following advice from mister_e, I'm sure you'll reach the finish line.

    http://www.picbasic.co.uk/forum/show...=6775#post6775

    DT

  3. #3
    Join Date
    Aug 2009
    Posts
    33

    Default

    I got it!!! It complied perfectly and now comes the hardware test. I’ll do the setup and let you know how it worked. I think the worse part is over. I thank you and indirectly to Melanie, Steve and many others that post their problems and solution in this forum. I want to learn all about these unique interrupts from the bottom up. I’ll be around here for some time. TimSeven

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Great, and don't forget Joe S.

    It's his serial backpack program.

    DT

  5. #5
    Join Date
    Jul 2007
    Posts
    65

    Default

    while it's alive..

    Darrel, i've made changes as per your recommandation,
    So, the skipchar label down here take care of characters not to be sent to LCD.
    that works!


    and then I had the *brilliant* idea to add something else...which failed.

    I know we're, but not sure why.


    Next I wanted to disable interrupt while I do my little LED dance at start, and send some message on the LCD.

    It seems like the code will stop at > ; @ INT_ENABLE RX_INT; this seem buggy...

    Do you see why I couldn't disable/enable INterrupts at start, or at that specific place?

    I taught maybe i should put this in a sub routine?



    Code:
    ; @ INT_DISABLE  RX_INT   ; Ignore input at initialisation
      
    HIGH LedPort	' Some visual sign of life for the PIC
    Pause 500		
    LOW LedPort
    pause 50
    
    lcdout $FE,1	'LCD INIT
    lcdout $FE,2
    LCDOUT "LCD SERIAL - READY"
    PAUSE 300  		' Timeout for LCD to settle
    
    ; @ INT_ENABLE  RX_INT  ; this seem buggy...
    
    ' * * * *   Main program starts here * * * * * * * *
    
    loop:  
            For i = 0 to 10 	' Delay for .02 seconds (10*2mS)
    	    	Pause 2   	' Use a short pause within a loop
    		Next i		' instead of one long pause
            
            For i = 0 to 10 	' Delay for .02 seconds (10*2mS)
    	        Pause 2   	' Use a short pause within a loop
    		Next i		' instead of one long pause
    
    skipachar:	; Will come back here if a char has to be skipped
    skipchar=0	; reset the flag so next char could be displayed
    
    display:			  	' dump the buffer to the LCD
    	IF errflag Then error	' Handle error if needed
    	IF index_in = index_out Then
              goto loop	' loop if nothing in buffer
              endif
    
    	GoSub getbuf	        ' Get a character from buffer	
    
            if skipchar=1 then skipachar  ; with goto up there, skipping display of the last read char
    
            LCDOut bufchar	        ' Send the character to LCD
    
    		IF col > 20 Then	    ' Check for end of line
    			col = 1		    ' Reset LCD location
    			LCDOut $fe,$c0,REP " "\20	' Clear line-2 of LCD
    			LCDOut $FE,2	    ' Tell LCD to return home
    		EndIF
    
            if ShowRTC=1 then
              LCDOut $FE,$D4,"RTC ACTIVED"
              EndIF
    
    GoTo display	' Check for more characters in buffer
    
    
    
    ' Subroutines
    
    ;Disable				' Don't check for interrupts in this section
    
    getbuf:					' move the next character in buffer to bufchar
      @ INT_DISABLE  RX_INT
    
        index_out = (index_out + 1)	' Increment index_out pointer (0 to 63)
    	' Reset pointer if outside of buffer
    	IF index_out > (buffer_size-1) Then index_out = 0	
    	bufchar = buffer[index_out]	' Read buffer location
    
        if skipLCDComm>0 then
           skipLCDComm=skipLCDComm-1
           endif
        ;Routine for buffering LCD commands
        if (GrabBkLt=1) then
           ; WE have signal to watch for value for LCD backlight next
           ; LCDOut $FE,$94,"BACKLIGHT set:<",#bufchar,">"  ; for debug only
    
           HPWM 1,bufchar ,1250    ; Setting Pulse Mod to desired value
           	' Observe minimum FREQ for given OSC speed. 20Mhz is 1221Hz
           Low LedPort 	; Debug only	
           GrabBkLt=0   ; All is done, signal to close the loop
           skipchar=1	; to skip displaying this char in main loop
           endif
        ;Following will trigger the routine up here on the next chr received
        ; but if skip if $fe has been called 2 shots ago
        if (bufchar=20) and (skipLCDComm=0) then  ; 14h, trigger for special LCD command
           HIGH LedPort  ; Debug only
           GrabBkLt=1  ; Signal to get the value of backlight level
           skipchar=1  ; ;to skip displaying this char in main loop
           endif
        ;Prevent value of 14h to be trapped for other command, we memorize previous call of $FE (254)
        if bufchar=254  then
           skipLCDComm=2 ;
           endif
     
      @ INT_ENABLE  RX_INT
    Return

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    flipper_MD,

    Are you a doctor, cause I've got this pain in my ...
    Oh ... you're probably a porpoise doctor

    Ummm no, I don't really see a reason for problems disabling at that point.

    The closest thing to a problem I can see is that the GrabBkLt command will take over 3ms to display the LCD data ... 2ms for the command and 20+ chars at 50us delay = 1ms.

    3ms by itself shouldn't be a problem, and it should only happen infrequently, but it's the closest thing to a problem I can see at first glance.

    What are the symptoms?
    DT

  7. #7
    Join Date
    Jul 2007
    Posts
    65

    Default

    Apparently, It will lock the PIC from receiving commands, if external data is received before it enter the main loop.

    Visually, It will flash the LED, show "LCD Serial - READY", but stop there and not respond.


    may I suggest Dr Pepper ?
    Sugar is food for the brain

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  2. Please help with EDE702 - Serial to LCD interface
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th October 2008, 02:48
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Serial LCD
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th November 2007, 08:31
  5. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts