12f675_fuse_about_to_blow! - Page 9


Closed Thread
Page 9 of 24 FirstFirst ... 567891011121319 ... LastLast
Results 321 to 360 of 929
  1. #321
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,

    You are correct, in your case it would be 230. (I missed that DEC2 you had in there).

    What I was really going for was the fact that you have all three variables, Num1, Num2 and Total all declared as Bytes. So 200 in Num1, that's fine. But 300 in Num2 won't work as it will overflow and will actually result in the value 44 in Num2 the Total would be 244. Same thing if you'd do 200+200, Num1 is fine and so is Num2 but 400 won't fit in Total... You seem to have that under control though!

    For the next exercise, why not make the PIC ask three questions like:

    Num1: (You input whatever)
    Operator: (You input +, - / or *)
    Num2: (You input whatever)

    And then present the result. That should make it a little easier to sort out - I think.

    /Henrik.

  2. #322
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi Henrik

    For the next exercise, why not make the PIC ask three questions like:Num1: (You input whatever) Operator: (You input +, - / or *) Num2: (You input whatever)
    Just to clarify: When I turn the Serial Communicator on, the PIC will send a request to the Communicator for NUM1, when I send that number, the PIC then asks the Comunicator for an 'operator' + - */ when the operator arrives the PIC then asks for NUM2 and then present the result.

    That should make it a little easier to sort out - I think.


    I'll give it a go.

    Dave

  3. #323
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi Guys

    I think I need a pointer. How do I 'capture' an 'operator'?

    When I want a DEC NUM1 sent I can see how [DEC NUM1] receives a decimal number. From the manual WAIT ( ) seems to be the best fit for an 'operator' or maybe something like CHAR " "

    Here's a section of the program:

    Code:
    OP VAR BYTE
    MAIN:
    PAUSE 7000
    SEROUT2 PORTC.3, 16780, ["Please send NUM1", 10, 13] 
    PAUSE 500
    HIGH PORTA.5          'Shows request sent
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SERIN2 PORTC.5, 16780, [DEC NUM1]'MODE 16780 = 2400 BAUD INVERTED
    PAUSE 500
    HIGH PORTA.5          'Shows data arrived
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SEROUT2 PORTC.3, 16780, ["Please send Operator + - * /"][WAIT OP( ),]  
    PAUSE 500
    HIGH PORTA.5          'Shows request sent
    PAUSE 1000
    LOW PORTA.5
    Here's were I'm struggling
    Code:
    SEROUT2 PORTC.3, 16780, ["Please send Operator + - * /"][WAIT OP( ),]
    Dave
    Last edited by LEDave; - 17th April 2010 at 00:31.

  4. #324
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,
    The WAIT modifier is used with serial input commands not with the serial output commands. It's used to only start "capturing" data starting with a certain character(s).

    Simply have your SERIN2 command capture the operator in a BYTE variable. Then, when you have Num2 as well you can use a bunch of IF-THENs to determine what the operator is, and act upon it accordingly OR even better, have a look at Select Case.

    Code:
    SERIN2 PORTC.5, 16780, [OP]    'MODE 16780 = 2400 BAUD INVERTED
    Every character, A,B,C, +, -, * etc is represented as a single byte number. So all you need to do is something like:
    Code:
    IF OP = "+" Then
      Total =  Num1 + Num2
    ENDIF
    And so on.

    Hope that helps.
    /Henrik.

  5. #325
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Henrik thank you.

    I was thinking in the right way (I had OP as a VAR BYTE) but just couldn't figure out how to receive and capture the operator.

    OR even better, have a look at Select Case.
    Will do.

    The thing I'm finding the hardest by far at the moment is interpreting what everything actually means.I read a line from the manual, all seems clear then suddenly the wheels fall off! It's rather like doing a crossword puzzle in a foreign language for me right now, I guess you guys have all been through this though.

    Practice, practice, practice.

    Dave

  6. #326
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Breaking News.........

    The LCD's have just arrived

    Dave

  7. #327
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi Henrik,

    How does this look? I went for the 'select case' in the end, I had to think for a while (nothing new there) but got there in the end.

    Code:
    ANSEL   = %00000000    'Disable analog select so ports work as digital i/o.
    CMCON0  = %00000111    'Disable analog comparators.
    TRISA   = %00000000    'Set PORTA as OUTPUT.
    PORTA   = %00000000    'Set PORTA pins all low.
    TRISC   = %00000000    'Set PORTC as OUTPUT.
    PORTC   = %00000000    'Set PORTC pins all low.
    
    DEFINE OSC 4
    
    NUM1 VAR BYTE
    
    OP VAR BYTE
    
    NUM2 VAR BYTE 
    
    TOTAL VAR BYTE
    
    
     
    MAIN:
    PAUSE 7000
    SEROUT2 PORTC.3, 16780, ["Please send NUM1", 10, 13] 
    PAUSE 500
    HIGH PORTA.5          'Shows data sent
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SERIN2 PORTC.5, 16780, [DEC NUM1]'MODE 16780 = 2400 BAUD INVERTED
    PAUSE 500
    HIGH PORTA.5          'Shows data arrived
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SEROUT2 PORTC.3, 16780, ["Please send Operator + - * /", 10, 13]  
    PAUSE 500
    HIGH PORTA.5          'Shows data sent
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SERIN2 PORTC.5, 16780, [OP] 'MODE 16780 = 2400 BAUD INVERTED
    PAUSE 500
    HIGH PORTA.5          'Shows data arrived
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SEROUT2 PORTC.3, 16780, ["Please send NUM2", 10, 13] 
    PAUSE 500
    HIGH PORTA.5          'Shows data sent
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SERIN2 PORTC.5, 16780, [DEC NUM2]'MODE 16780 = 2400 BAUD INVERTED
    PAUSE 500
    HIGH PORTA.5          'Shows data arrived
    PAUSE 1000
    LOW PORTA.5
    
    Select case OP
    CASE "+"
    TOTAL = NUM1 + NUM2
    CASE "-"
    TOTAL = NUM1 - NUM2
    CASE "*"
    TOTAL = NUM1 * NUM2
    CASE "/" 
    TOTAL = NUM1 / NUM2
    END SELECT
    
    pause 250
    SEROUT2 PORTC.3, 16780, [DEC TOTAL, 10,13]
    PAUSE 250 
    GOTO MAIN
    I did another version using IF-THEN as you showed me.

    Code:
    PAUSE 250
    IF OP = "+" Then
    Total =  Num1 + Num2
    
    PAUSE 250
    IF OP = "+" Then
    Total =  Num1 + Num2
    ENDIF
    
    PAUSE 250
    IF OP = "-" Then
      Total =  Num1 - Num2
    ENDIF
    
    PAUSE 250
    IF OP = "*" Then
      Total =  Num1 * Num2
    ENDIF
    
    PAUSE 250
    IF OP = "/" Then
      Total =  Num1 / Num2
    ENDIF
    Last edited by LEDave; - 17th April 2010 at 19:43.

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


    Did you find this post helpful? Yes | No

    Default

    Well that was easy....
    We need to think of something harder
    Dave
    Always wear safety glasses while programming.

  9. #329
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit

    Well that was easy....
    Only because you and Henrik are such good teachers....!

    We need to think of something harder
    Ok, but be gentle with me.

    How about this:

    Yup, Write code and set the hardware up so whatever you send to the PIC® echos bach to the PC
    From an earlier brief.

    Dave

  10. #330
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Looking good Dave! As you see the Select Case can provide a much cleaner look than the IF THEN in some cases. What you also can do is have a CASE ELSE where you "capture" invalid input (anything BUT + - / *).

    You have a lot of Pauses in there that doesn't need to be there if there's no specific reason for it.

    Now, since you have the LCD, why not make the messages appear on it instead of the PC-screen? You can still receive the "commands" thru the PC, to begin with.

  11. #331
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi Henrik,

    Now, since you have the LCD, why not make the messages appear on it instead of the PC-screen? You can still receive the "commands" thru the PC, to begin with.


    That would be brilliant, I'm ready when you are!

    I've uploaded the PDF for the LCD.

    Quick point, on my PICkit1, I'm using two 22k resistors on the DB9 data cable (pin2&3) do I still use these for the LCD?

    Dave
    Attached Images Attached Images

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


    Did you find this post helpful? Yes | No

    Default

    Hey Dave,
    I will but back in....

    Check out the LCD section of the manual and compare to the LCD data sheet for the pin outs. Make needed adjustments and....
    Dave
    Always wear safety glasses while programming.

  13. #333
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Make needed adjustments and....
    I'm not sure how much of the display I need to connect up?

    How does this look / sound:

    PIN1 - VSS - GND
    PIN2 - VDD - +5V
    PIN3 - V0 - 20k pot (contrast)
    PIN4 - RegSel - PORTA.4? with 10k pull res.
    PIN5 - ReadWrite - GND
    PIN6 - PORTB.3?

    PIN11 - D4 - I/O - Data LSB - PORTA.0?
    PIN12 - D5 - I/O - Data - PORTA.1?
    PIN13 - D6 - I/O - Data - PORTA.2?
    PIN14 - D7 - I/O - Data MSB - PORTA.3?

    The manual qoutes for a PIC16F84 I'm using a 16F684, don't forget, hence the question marks.
    I'm thinking it still applies the same though.

    Dave
    Last edited by LEDave; - 18th April 2010 at 23:32.

  14. #334
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,
    That looks OK to me. Don't forget that if your pin assignment differs from the "standard" shown in the manual (I haven't checked but I think yours is different) you need to DEFINE that as shown in the manual. Simply copy the complete DEFINE-block to your code and change it to match your setup.

    /Henrik.

  15. #335
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi Henrik

    I've bought a breadboard today and have decided to make the project on it.
    So starting from scratch really.

    Yes the code does need adjusting to match the manual (probably the best way around at this stage) so lots to do and think about.

    If this LCD ever fires up and works it'll be a minor, no major miracle!

    Dave

  16. #336
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Not having a very good night here. I've been working realy hard with zero results so far.

    I've attached wires 1-6 on to the LCD - power supply - and PIC (the PIC hasn't been DEFINED yet) but the LCD display hasn't shown any sign of life at all (I was just hoping the display would at least light up).

    My only hope is that the PIC has to have the right DEFINE's in place even to light up, fingers x'd that's the case, or NASA I've got a problem

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    I would not expect much till it is all connected and coded.
    Do you have a POT on he contrast pin?

    Still having trouble after all is connected post the connections, code, and trouble having.
    Do not forget to turn off the ADC...
    Dave
    Always wear safety glasses while programming.

  18. #338
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    Yes there is a pot on the contrast pin, the manual said 20k best I could buy today was a 25k (I turned the pot just in case it was 'dark') the display never lit up though.

    So I need to get the right program settings into the PIC before it will even light up then? That's a good thing, because there's still hope!

    I'll have a try at getting the program set up tomorrow and see what you and Henrik think. There aren't any DEFINES at all inside the PIC at the moment (might just explain it I guess).

    Dave
    Last edited by LEDave; - 19th April 2010 at 23:40.

  19. #339
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,
    I went over your suggested connection scheme again and it looks OK. I would expect the LCD segments to at least be visible with the contrast pot is turned towards one end - that's what I've seen on other displays. But don't worry, get it all connected and get some basic code into the PIC.

    I'm not 100% sure if the LCDOut commands automatically sets the TRIS registers for the Enable and RS bit of the LCD but it certanly doesn't hurt to do that "manually" just to be sure it's correct. And, as mackrackit already pointed out, don't forget the ADC.

    I think these DEFINEs should match your connection scheme:
    Code:
    DEFINE LCD_DREG PORTA    'Databus, D4-D7 on PortA
    DEFINE LCD_DBIT 0        'Starting at PortA.0
    
    DEFINE LCD_RSREG PORTA   'LCD RegisterSelect on PortA...
    DEFINE LCD_RSBIT 4       '...bit4
    
    DEFINE LCD_EREG PORTB    'LCD Enable-signal on PortB...
    DEFINE LCD_EBIT 3        '...bit 3
    
    DEFINE LCD_LINES 2       'LCD has two lines and...
    DEFINE LCD_BITS 4        '...is using 4 bit databus
    
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    /Henrik.

  20. #340
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    .....................
    Last edited by LEDave; - 20th April 2010 at 08:46.

  21. #341
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi Henrik

    Here's what I'd come up with late last night (I wish I'd posted it now before I went to bed as not the far off I don't think).

    Code:
    DEFINE LCD_DREG PORT.A        ' Set LCD Data port
    DEFINE LCD_DBIT 0             ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORT.A       ' Set LCD Register Select port
    DEFINE LCD_RSBIT 4            ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTC         ' Set LCD Enable port
    DEFINE LCD_EBIT 0             ' Set LCD Enable bit
    DEFINE LCD_BITS 4             ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 4            ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2000     ' Set command delay time in us
    DEFINE LCD_DATAUS 50
    I set LCD_LINES 4 as the display is a 4*20.

    The one I'm missed was LCD_EBIT 0 (it was late).

    Also the PIC is a 16F684 PORTA and PORTC

    Thank you for taking the time to do go through it all though (really appreciated) I'll load it later today and hopefully have some success (I'm just a little worried I've fried the LCD).

    David
    Last edited by LEDave; - 20th April 2010 at 09:03.

  22. #342
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hi Dave,
    Ah, OK - I never crosschecked with the PIC datasheet, I only referenced your proposed connection scheme and LCD datasheet. So, PORTA and PORTC it is.

    One thing though, there's not supposed to be dot in PORT.A it's just PORTA. The thing with DEFINEs is that they won't produce any error messages etc so you have to make sure you write them correctly or it simply won't work properly.
    Last edited by HenrikOlsson; - 20th April 2010 at 09:42.

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


    Did you find this post helpful? Yes | No

    Default

    PORTA.3 is input only so you will need to move this over to portC.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    How about doing it like this. The whole thing will be on PORTC. That will keep away from the MCLR and programming and POT(if still using the PICKIT1) pins.
    Code:
    DEFINE LCD_DREG     PORTC 'PORTC.0 WILL CONNECT TO DB4, PORTC3 TO DB7
    DEFINE LCD_DBIT     0
    DEFINE LCD_RSREG    PORTC
    DEFINE LCD_RSBIT    4          'PORTC.4 CONNECT TO LCD PIN4
    DEFINE LCD_EREG     PORTC
    DEFINE LCD_EBIT     5            'PORTC.5 CONNECT TO LCD PIN6
    DEFINE LCD_BITS     4
    DEFINE LCD_LINES    4
    DEFINE LCD_COMMANDUS 2000     
    DEFINE LCD_DATAUS 50
    LCD pins
    1 and 5 to VSS
    2 to VDD
    3 to wiper on POT
    Dave
    Always wear safety glasses while programming.

  25. #345
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    I've moved the whole thing over to the breadboard and wired it on there.

    A couple of quick things:

    Yes the manual shows a 10k res on MCLR, I've put one on PORTA.3 which probably isn't a good idea.

    I've checked the voltage on the display itself earlier:

    Across pin 1-2 = 4v (with pin 1 as GND)
    Across pin 1-3 = it goes from 0 - 3.94v
    Across pin 2-5 = 3.92v

    Also (I've just noticed this) when I turn the POT, the top and third line of the display get darker, so something's going on or trying to.

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


    Did you find this post helpful? Yes | No

    Default

    I would turn MCLR off then you can use that pin as an input.

    Display sounds like it is alive
    Dave
    Always wear safety glasses while programming.

  27. #347
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    To do that I add: @ DEVICE PICI6F684, MCLR_OFF (just checking).

    Display sounds like it is alive. It does yes

    I was hoping for a nice vivid blue but right now I'l take the slate grey through to black

  28. #348
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    You may not see the blue color until the backlight is powered up.


    steve

  29. #349
    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 LEDave View Post
    To do that I add: @ DEVICE PICI6F684, MCLR_OFF (just checking).
    That would do it.
    Not sure if we have talked about configs yet?
    How are you setting them?
    Dave
    Always wear safety glasses while programming.

  30. #350
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    No we haven't touched on them yet (CONFIGS). I have read a little about them, If I'm honest though at this stage or up to now if the programs compiled and run great.

    We will have to cover them soon though.

    A few jobs around the house then back on the display! It will work, I know it will (I think).

    Dave

  31. #351
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    UPDATE:

    I think the cct is wired up somewhere handy (non technical term). I was a bit unlucky in that I bought a ribbon cable for the job which had the finest wire inside I've ever seen, so had to solder some stiffer 'legs' on to all the wires which kept breaking off, grrr.

    The LCD still shows the same 2 dark lines when the pot is turned.

    I went for your PORTC option in the end mackrackit (@ DEVICE PICI6F684, MCLR_OFF wouldn't compile for one).

    One thing, as Henrik said earlier:
    I'm not 100% sure if the LCDOut commands automatically sets the TRIS registers for the Enable and RS bit of the LCD but it certanly doesn't hurt to do that "manually" just to be sure it's correct.
    Right now I'm not sure what to set the TRIS registers to for this.

    The only other thing I know I haven't done is transfer the GROUND - PIN2 - PIN2 from the PICKit1 (serin / out) to the LCD display.

    Ok, here's the program as it stands:

    Code:
    ANSEL   = %00000000    'Disable analog select so ports work as digital i/o.
    CMCON0  = %00000111    'Disable analog comparators.
    TRISA   = %00000000    'Set PORTA as OUTPUT.
    PORTA   = %00000000    'Set PORTA pins all low.
    TRISC   = %00000000    'Set PORTC as OUTPUT.
    PORTC   = %00000000    'Set PORTC pins all low.
    
    DEFINE LCD_DREG     PORTC 'PORTC.0 WILL CONNECT TO DB4, PORTC3 TO DB7
    DEFINE LCD_DBIT     0
    DEFINE LCD_RSREG    PORTC
    DEFINE LCD_RSBIT    4          'PORTC.4 CONNECT TO LCD PIN4
    DEFINE LCD_EREG     PORTC
    DEFINE LCD_EBIT     5          'PORTC.5 CONNECT TO LCD PIN6
    DEFINE LCD_BITS     4
    DEFINE LCD_LINES    4
    DEFINE LCD_COMMANDUS 2000     
    DEFINE LCD_DATAUS 50
    
    DEFINE OSC 4
    
    NUM1 VAR BYTE
    OP VAR BYTE
    NUM2 VAR BYTE 
    TOTAL VAR BYTE
    
    MAIN:
    PAUSE 7000
    SEROUT2 PORTA.0, 16780, ["Please send NUM1", 10, 13] 
    PAUSE 500
    HIGH PORTA.5          'Shows data sent
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SERIN2 PORTA.2, 16780, [DEC NUM1]'MODE 16780 = 2400 BAUD INVERTED
    PAUSE 500
    HIGH PORTA.5          'Shows data arrived
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SEROUT2 PORTA.0, 16780, ["Please send Operator + - * /", 10, 13]  
    PAUSE 500
    HIGH PORTA.5          'Shows data sent
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SERIN2 PORTA.2, 16780, [OP] 'MODE 16780 = 2400 BAUD INVERTED
    PAUSE 500
    HIGH PORTA.5          'Shows data arrived
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SEROUT2 PORTA.0, 16780, ["Please send NUM2", 10, 13] 
    PAUSE 500
    HIGH PORTA.5          'Shows data sent
    PAUSE 1000
    LOW PORTA.5
    
    PAUSE 250
    SERIN2 PORTA.2, 16780, [DEC NUM2]'MODE 16780 = 2400 BAUD INVERTED
    PAUSE 500
    HIGH PORTA.5          'Shows data arrived
    PAUSE 1000
    LOW PORTA.5
    
    Select case OP
    CASE "+"
    TOTAL = NUM1 + NUM2
    CASE "-"
    TOTAL = NUM1 - NUM2
    CASE "*"
    TOTAL = NUM1 * NUM2
    CASE "/" 
    TOTAL = NUM1 / NUM2
    END SELECT
    
    pause 250
    SEROUT2 PORTA.0, 16780, [DEC TOTAL, 10,13]
    PAUSE 250 
    GOTO MAIN
    Last edited by LEDave; - 20th April 2010 at 23:52.

  32. #352
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    I've just transfered the GROUND - PIN2 - PIN3 from the PICKit1 (serin / out) to the PIC / LCD display.The program works on the pc serial communicator as before but doesn't show anything up on the LCD which is a shame.


    Dave

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


    Did you find this post helpful? Yes | No

    Default

    Maybe you should put something in your code to send data to the LCD??
    Code:
    LCDOUT $FE,1,"Hello World!"
    Dave
    Always wear safety glasses while programming.

  34. #354
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    LCDOUT $FE,1,"Hello mackrackit"
    It WORKED!!!!!!!!!!!!!!!

    Fantastic, what a buzz!

    Right I'm to bed now it's really late, really pleased with that

    Thanks for your help everyone.

    Dave
    Last edited by LEDave; - 21st April 2010 at 01:28.

  35. #355
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    The display's looking good

    I guess I should do some reading on LCD characters '$FE,1,' etc and figure out how they work.

    Absolutely brilliant to see it actually come to life late last night.

    Thanks again to everyone.

    David

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


    Did you find this post helpful? Yes | No

    Default

    To have a little fun check this out
    http://www.picbasic.co.uk/forum/showthread.php?t=242
    Dave
    Always wear safety glasses while programming.

  37. #357
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    I'll have a look when I get the display running properly. I've got a slight problem at the moment:

    Lines 1 & 3 are fine. Line 2, the top half of the characters are fine and I can make out the bottom half. Line 4 top half fine, bottom half of the characters is missing.

    It seems like a contrast issue on the pot. If I could only turn the pot down another quarter turn but I've run out of pot.

    Would getting the back-light fired up help do you think?

    Dave

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


    Did you find this post helpful? Yes | No

    Default

    You might try increasing the DATAUS number.
    Dave
    Always wear safety glasses while programming.

  39. #359
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Have tweaked the DATAUS and can see pretty much all the characters, cheers.

    I'm slightly embarrassed but I'll fess-up. I'm still having a problem with the back-light.

    The display pdf shows the Anode / cathode on pins 15 / 16 with the current as below:

    With B/L ILED VLED=5.0V -- 72 80 mA
    So I'm thinking at 5v with 75ma a 60 ohm resistor on pin 15, pin 16 ground should do it.

    I always thought LED's worked on about 25ma, must be a big LED inside then?

    Dave

  40. #360
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post

    So I'm thinking at 5v with 75ma a 60 ohm resistor on pin 15, pin 16 ground should do it.

    I always thought LED's worked on about 25ma, must be a big LED inside then?

    Dave
    It may have one big LED, or several smaller ones in parallel.
    I have some Lumex displays that are rated for up to 160mA. But they are viciously bright at that level and I rarely run them at more than 50mA.
    For dim lighting conditions, I may run them at 20mA..

    I'd start with about 1/2 current and see how it goes. No need to run them any harder than necessary. If you've got 100 ohms, or 200 even, give it a go.

    Don't forget that resistor wattage... a 60 ohm resistor @ 75mA = 0.3375 watts dissipated.

    Steve

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