Anyone know a place in UK to get some of these?
looking at the specs it looks exactly what i need to remotely mount an LCD but have the controller a few feet away
Anyone know a place in UK to get some of these?
looking at the specs it looks exactly what i need to remotely mount an LCD but have the controller a few feet away
I cannot believe you are considering spending money on a part, where a simple PIC (like a 16F628 or similar) for 90p and a dozen lines of PICBASIC code would do the same thing. BTW are you aware that Darrel's taken a parallel LCD (search this forum) and run a near infinite length of wire on it and it still worked? 'A few feet' hardly seems to warrant the effort.
And you know the best ???
The EDE circuits ARE programmed PICs ...
no, no, Karen ... don't cry ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Umm no I didn't know that
What I want to do is mount the LCD remotely but only use a minimum amount of wires if that makes sense, I was thinking about i2c bus but I know nothing about that at the moment, then thought of serial so thought it might be the easiest
However if the length of the wired dont matter then all I really need is 8 wires (including + and -V so it's not as bad as it seems, i was just hoping to use a "standard" type connector like usb with 4 wires and so on.
Grrrrrr.....Originally Posted by Acetronics
what a rip off!
although it is a novel idea, if only I was confident enough to program a chip to do it, but at the moment I've still no idea how serial works lol!
Last edited by karenhornby; - 16th June 2008 at 15:14.
Depends on how long of a wire you're talking about. If it's not too long, a standard 3 wire stereo headset extension might do the trick (V+, Grnd, Serial Data) and be cheap. Hook it up, and see how fast it'll go before the data starts to get flakey.
Most off-the-shelf serial LCD modules will only go 'so slow', maybe 2400baud. The slower you send serial, the farther you can send it over a regular chunk of wire. So, if you end up building your own module (which is very very easily done by the way), you could, in theory, make it as slow as you need, or get all sorts of complicated (RS drivers, error correction, the whole ball of wax).
Here's a good start on the whole serial LCD backpack thing:
http://www.picbasic.co.uk/forum/show...erial+backpack
Last edited by skimask; - 16th June 2008 at 15:23.
I'll either just use a standard lcd (which I have) and use longer wires and see if it works, or as I'm about to go check the info you suggested I may make my own serial interface (then got to learn how to program/use serial lol)
unless anyone comes up with other ideas.. all welcome
just out of curiousity, how easy is it to use an i2c bus? I see chips on ebay that "aparently" connect direct to a parallel lcd but the input is just i2c ?
Probably won't work reliably with any sort of distance between point A and point B.
The serial LCD is a piece of cake and the code is right there at that link...some tweaking for your needs and you're in there.or as I'm about to go check the info you suggested I may make my own serial interface (then got to learn how to program/use serial lol)
I2C bus? Not so easy. PBP only 'speaks' I2C Master, not slave, at least not without a lot of effort. An I2C LCD on eBay? Don't think I've seen those yet... Serial...Yes. I2C sounds like more trouble than it's worth.unless anyone comes up with other ideas.. all welcome
just out of curiousity, how easy is it to use an i2c bus? I see chips on ebay that "aparently" connect direct to a parallel lcd but the input is just i2c ?
The code is intersting and could easily be "manipulated?" for my needs thanks
The thing I'm struggling with in regards to serial is an actual circuit diagram for a "piggyback board" for the lcd to accept serial output direct from the pic
Forgot to say:
timing's aren't important all it's going to be doing is displaying temperatures from either 2 or 3 ds18B20's
although I'm going to be cheating as such and having each ds18b20 on it's seperate pin as it's too much trouble to try and work out the address of each chip and then how to "talk" to that specific one if they are all on the same pin.
The only problem is obviously it's going to use way more code than nessesary otherwise
Last edited by karenhornby; - 16th June 2008 at 16:03.
Nothing special, straight wire for serial from PIC to PIC, maybe an inline 100ohm resistor for protection (no real need for a MAX232 or the like unless you get crazy with distance), straight wires for power and ground...
Past the receiver PIC, it's standard wiring from PIC to LCD.
If you can make a PIC and an LCD work, you can do this easily.
Just try to remember not to shoot yourself in the foot...small steps...get blinky working, get the LCD working, get 2 PICs working, get some serial going between the two, tie it all together.
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 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?
Last edited by karenhornby; - 16th June 2008 at 17:07.
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.
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?
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.
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.
>>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:
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 16F648ACode:;---- 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
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.
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.
4. (Always my biggest point anyways) You get to say to other people: "Hey, I built that."
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
Bookmarks