EDE702 where?


Closed Thread
Results 1 to 19 of 19

Thread: EDE702 where?

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Been looking through old posts, what I'd ideally like to do is "convert?" the LCD module to work as 1wire
    The attached circuit looks extremely intersting if it could be made work easily enough (done more research it looks like Melanie, it's one of your circuits?)
    now all I have to do is try and figure out how to make shiftout work for an lcd lol

    However found this which lookin interesting (circuit taken from one of the posts there) http://www.picbasic.co.uk/forum/showthread.php?t=3981
    Post 13
    Quote Originally Posted by skimask View Post
    TX side - SEROUT directly replaces LCDOUT (pick your serial transmit format, i.e. baud rate, parity, etc)

    RX side - SERIN data feeds byte information directly to LCDOUT (again, pick your serial receive format to math the transmit side)

    3 wires - power, ground, serial transmit data
    I just dont get how it works.

    SEROUT is what your sending from the "main pic" obviously but does that assume you have another pic piggybacked to the lcd directly? and if so how does THAT pic know that what comes in on the serin command equates to lcdout?
    if so does anyone have a circuit for this? and any code examples around?
    Attached Images Attached Images  
    Last edited by karenhornby; - 16th June 2008 at 17:07.

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by karenhornby View Post
    it's THAT simple?
    here's a harder question then, say my pic (main pic) wants to tell the "lcdout $fe,c0 "the Temperature is"
    the "piggback pic" would simple output to the lcd "lcdout $fe,c0 "the Temperature is"

    BUT what would the main pic actually be outputting on it's pin?
    if that question makes sense, sorry never was any good at explaining things

    Other question (sorry for so many)

    Is there a chip such as the ds2408 that could be "piggybacked" onto the lcd module and convert it to 1-Wire® bus?
    That would make it worth using the actual proper 1-Wire® bus especially if the lcdout command works the same as parallel lcd
    Hi KarenHornby,
    1 wire bus is a bit of a misnomer as they take at least 2 and usually 3, and that is all the serial backpack takes. Format your strings like LCDOUT as far as telling the lcd which line and which character to begin at, I usually use 9600 baud, so a typical serout statement;<br>
    SEROUT YourPort,T9600,[254,1,"Karen's Project"]
    SEROUT YourPort,T9600,[254,192,'This is FUN"]
    <br>
    YourPort = the pic pin you choose
    254 of $FE, 192 or $C0, which is to say, same as in LCDOUT HEX or DEC. this backpack uses HSERIN so you must send data TRUE.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    I'm still lost in a world ruled by machines
    I get what your saying ( I think)
    I use serout and then whatever I would have typed after the lcdout command?
    But on the 2nd pic it receives serin and then outputs that to the lcd as lcdout?
    so basically what I type on the 1st pic, goes down the serial lead and gets written to the 2nd pic by the serin command?
    IF I've got that correct, what kind of code do I need ot put in the 2nd pic to convert whats coming INTO it as serin, to process it as lcdout?
    also stupid question prob but apart from power, is all I need to connect the 2 pics together serout pin to serin pin? or am I missing something?

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Hi Karen,

    Yes to all of your questions but the one about code on LCD pic. That code can be found in the link skimask provided.

    I would suggest that for the first time you use a pr-made serial LCD. Then when that works build you own. Like we say...step by step.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    I would suggest that for the first time you use a pr-made serial LCD. Then when that works build you own. Like we say...step by step.
    The reasons for this unit, as opposed to using "off the shelf" unit, 1: cost about $10 US using import LCD, 2: This is the biggie . . . code formatting, I found several off the shelf backpacks all used different formatting, so if you are building a product, then you have to rewrite the code when you change vendors, 3: Control of the code.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    4. (Always my biggest point anyways) You get to say to other people: "Hey, I built that."

  7. #7
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Thanks guys, you've been a great help
    I'm going to try building my own and it will take me some time to get it working but I'll persevere

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    The reasons for this unit, as opposed to using "off the shelf" unit, 1: cost about $10 US using import LCD, 2: This is the biggie . . . code formatting, I found several off the shelf backpacks all used different formatting, so if you are building a product, then you have to rewrite the code when you change vendors, 3: Control of the code.
    Quote Originally Posted by skimask View Post
    4. (Always my biggest point anyways) You get to say to other people: "Hey, I built that."
    I agree with all points. Just trying to cut the frustration level down. You know, the blinky thing.

    Go for it Karen. As always, there will be someone here to help if you need it.
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    >>karenhornby;I'm still lost in a world ruled by machines
    I get what your saying ( I think)
    1:I use serout and then whatever I would have typed after the lcdout command?
    2:But on the 2nd pic it receives serin and then outputs that to the lcd as lcdout?
    so basically what I type on the 1st pic, goes down the serial lead and gets written to the 2nd pic by the serin command?
    1: YES
    2: YES

    IF I've got that correct, what kind of code do I need output in the 2nd pic to convert whats coming INTO it as serin, to process it as lcdout?
    also stupid question prob but apart from power, is all I need to connect the 2 pics together serout pin to serin pin? or am I missing something?

    Not sure I got that right . . . you hook 3 wires from the backpack unit to your project: Power, Ground, and signal. The code listed in post 16 of the thread skimask directed you to as last modified by Darrel . . heck I'll repost it here:
    Code:
    ;---- Config settings for MPASM ----------------------------------------------
    @  __config _HS_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
    
    trisb = %00000010
    trisA = %11110011
    ;include "modedefs.bas"
    
    ;----Added by DT--------------------------------------------------------------
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
    
    ASM
    INT_LIST  macro   ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    RX_INT,    _serialin,   PBP,  no
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   RX_INT     ; enable external (INT) interrupts
    ;-----------------------------------------------------------------------------
    
    ' Define LCD registers and bits
    Define  LCD_DREG        PORTB
    Define  LCD_DBIT        4
    Define  LCD_RSREG       PORTA
    Define  LCD_RSBIT       0
    Define  LCD_EREG        PORTA
    Define  LCD_EBIT        1
    
    DEFINE LCD_LINES 4		     'Define using a 2 line LCD
    DEFINE LCD_COMMANDUS 2000	 'Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 50	     'Define delay time between data sent.
    DEFINE OSC 20
    
    DEFINE HSER_RCSTA 90h        ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h        ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 32         ' FOR 20MHZ 129 = 2400, 32=9600,25 @ 4 for 2400
    DEFINE HSER_CLROERR 1        ' Clear overflow automatically
    
            RCIF VAR PIR1.5      ' Receive  interrupt flag (1=full , 0=empty)
            TXIF VAR PIR1.4      ' Transmit interrupt flag (1=empty, 0=full)
    LED VAR PORTA.4
    
    OERR	VAR	RCSTA.1		     ' Alias OERR (USART Overrun Error Flag)
    CREN	VAR	RCSTA.4		     ' Alias CREN (USART Continuous Receive Enable)
    buffer_size	CON	64		     ' Sets the size of the ring buffer, set up from 32
    buffer	VAR	BYTE[buffer_size]' Array variable for holding received characters
    index_in	VAR	BYTE 	     ' Pointer - next empty location in buffer
    index_out	VAR	BYTE	     ' Pointer - location of oldest character in buffer
    bufchar	VAR	BYTE		     ' Stores the character retrieved from the buffer
    i		VAR	BYTE		     ' loop counter 
    Col		VAR	BYTE		     ' Stores location on LCD for text wrapping
    errflag	VAR	BYTE		     ' Holds error flags
    index_in = 0
    index_out = 0
    i = 0
    col = 1
    
                                    'RxData var byte        
            CMCON = 7               ' PORTA is digital
            Pause 100               ' Wait for LCD to startup
            high PortA.2            ' power for backlight
            low  PortA.3            ' backlight ground
    ;INTCON = %11000000	            ' Enable interrupts
    ;ON INTERRUPT GoTo serialin		' Declare interrupt handler routine
    ;PIE1.5 = 1				        ' Enable interrupt on USART
    pause 1500
    lcdout $FE,1
    lcdout $FE,2
    LCDOUT "Your Text Goes Here"
    PAUSE 2000
    
    ' * * * * * * * * * * * * *   Main program starts here - blink an LED at 1Hz
    ' I removed some code here, it seems to require what's left
    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
    
    
    display:			  	        ' dump the buffer to the LCD
    		IF errflag Then error	' Handle error if needed
    		IF index_in = index_out Then loop	' loop if nothing in buffer
    
    		GoSub getbuf	        ' Get a character from buffer	
    		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
    
    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
      @ INT_ENABLE  RX_INT
    Return
    
    
    error:					          ' Display error message if buffer has overrun
    	IF errflag.1 Then	          ' Determine the error
    		LCDOut $FE,$c0,"Clearing Display    Buffer"	' Display buffer error on
                                                        ' line-2 and 3 Buff overrun
    	Else
    		LCDOut $FE,$D4,"USART Overrun"	' Display usart error on line-4
    	EndIF
    	
    	LCDOut $fe,2		            ' Send the LCD cursor back to line-1 home
    	For i = 2 to col	            ' Loop for each column beyond 1
    		LCDOut $fe,$14	            ' Move the cursor right to the right column
    	Next i                          ' $14 = 20 DEC.
    	
    	errflag = 0			' Reset the error flag
    	CREN = 0			' Disable continuous receive to clear overrun flag
    	CREN = 1			' Enable continuous receive
    
    	GoTo display		' Errors cleared, time to work.
    	
    	
    ' * * * * * * * * * * * * * * *  Interrupt handler
    
    serialin:				        ' Buffer the character received
    	IF OERR Then usart_error	' Check for USART errors
    	index_in = (index_in + 1)	' Increment index_in pointer (0 to 63)
    	IF index_in > (buffer_size-1) Then index_in = 0	'Reset pointer if outside of buffer
    	IF index_in = index_out Then buffer_error	' Check for buffer overrun
    	HSerin [buffer[index_in]]	' Read USART and store character to next empty location
    	IF RCIF Then serialin		' Check for another character while we're here
    ;resume	
    @  INT_RETURN   		        ; Return to program
    
    buffer_error:
    	errflag.1 = 1		' Set the error flag for software
    ' Move pointer back to avoid corrupting the buffer. MIN insures that it ends up within the buffer.	
    	index_in = (index_in - 1) MIN (buffer_size - 1)	
    	HSerin [buffer[index_in]]	' Overwrite the last character stored (resets the interrupt flag)
    usart_error:
    	errflag.0 = 1		' Set the error flag for hardware
    ;resume	
    @  INT_RETURN   		        ; Return to program
    
    
    End
    You MUST compile with MPASM and you MUST put the include files in the directory your code is in to compile. This gives you a ring buffer so you do not lose characters. PIC used was 16F628A or 16F648A
    Last edited by Archangel; - 16th June 2008 at 21:06.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by karenhornby View Post
    Been looking through old posts, what I'd ideally like to do is "convert?" the LCD module to work as 1wire
    You 'could' do that...but the LCD/PIC combo would have to be self-powered obviously.
    And...you'd have to figure out a way to be able to detect a logic level change on the receiving end without a ground reference (i.e. how do you know you've got +5v if you don't know what ground is at?). And, yes, there is a relatively easy way to do this.

Similar Threads

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

Members who have read this thread : 0

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