LCD BARgraphs - Page 3


Closed Thread
Page 3 of 6 FirstFirst 123456 LastLast
Results 81 to 120 of 233

Thread: LCD BARgraphs

  1. #81
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Talking

    Hi,

    For Portb.1 ...

    you've declared it as an Input ... and drive a led with it ... so, it's an OUTPUT !!!

    ...

    I think the Interrupt problem could be here ... I remember a thread explainining a Change in the I/Os disabled the Pullups ...

    YESS it is !!! ... just over Fig 3.3 of the Datasheet ...

    Tadaaaaaaa ..... one RTFM for you !!!

    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 " !!!
    *****************************************

  2. #82
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    The LED is on portb.2. Portb is set as all outputs except bit 1. See the trisb=1

    So, where is the ... Tadaaa?? :-)

    Ioannis
    Last edited by Ioannis; - 26th June 2007 at 13:06.

  3. #83
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    The LED is on portb.2. Portb is set as all outputs except bit 1. See the trisb=1

    So, where is the ... Tadaaa?? :-)

    Ioannis

    No tadaaaaaa ... just read a bit too quickly ( TRISx = %00000001 is so much easier to look at ...)

    Strange ... i tried DT interrupts quite the same way ... no problems.
    Last edited by Acetronics2; - 26th June 2007 at 13:36.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  4. #84
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    I think I am,

    trisb=1 is equal to:

    trisb=%00000001

    Isn't this bit 0 of port b set as input?

    Ioannis

  5. #85
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Looks good ...

    I tried THAT in MPSIM ... Works Great ...




    INCLUDE "C:\PBP\MODEDEFS.BAS"
    DEFINE OSC 4

    INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
    INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts

    LED1 VAR PORTB.2

    trisa=1:trisb=1:trisc=0:trisd=0:trise=0
    PORTA=0:PORTB=0:PORTC=0:PORTD=0:PORTE=0

    OPTION_REG = %00100001 ; Set TMR0 Prescaler to /2, RBPU on

    adcon0=%10000000 'Fosc/32, ADC ON
    adcon1=%10001110 'Right Justify, RA0 Analog, rest Digital I/O

    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler INT_INT, _ToggleLED1, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor

    INT_ENABLE INT_INT ; enable external (INT) interrupts
    ENDASM

    Main:
    pause 1
    GOTO Main

    '---[INT - interrupt handler]--------------------------------------------------
    ToggleLED1:
    high LED1: pause 100:low led1
    @ INT_RETURN


    I just modified OPTION_REG value cause little things seemed strange to me ...

    try it ... huuu ... is processor a 16F877 ????

    Alain
    Last edited by Acetronics2; - 26th June 2007 at 14:02.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  6. #86
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    Yes Alain, MCU is 16F877, but this is minor.

    Do you mean that with OPTION_REG=$81 does not work also at your test?

    I have not the board with me at work now. I will test it late today.

    Ioannis

  7. #87
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Wink

    I have an old 877 here...

    I'll breaboard it ...

    We'll see !!!

    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 " !!!
    *****************************************

  8. #88
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Smile Original Code is OK

    Hi, Ioannis

    YOUR code has passed the Breadboard test ...

    Works as expected ... ( little flash when PORTB.0 tied to ground )

    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Looking at the PICDEM2+ schematic some more, it seems that there might be a conflict with PORTB.0

    <img src=http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1794&stc=1&d=118289364 1>

    With J6 installed (has to be for the LED on PORTB.2), the LED on PORTB.0 may not allow the voltage to rise far enough to register a HIGH level.
    <br>
    Attached Images Attached Images  
    DT

  10. #90
    Join Date
    Jan 2007
    Posts
    24


    Did you find this post helpful? Yes | No

    Thumbs up AWESOME!!!!! (again)

    I joined in this quite late, but on the original bargraph code posted by Darrel (and also the interrupt code posted elsewhere) I have one thing to say....WOW Darrel. GENIUS.. BOTH of these snippets have saved me hours of work on a project I'm working on.

    I needed to poll an array of front panel switches every few milliseconds AND service a bargraph update AND change the frequency of a HPWM signal all at set times, I was in the process of writing an RTOS for the PIC to allow me to use queued commands executed on a priority/time basis, then these two pieces of code went live.

    OK, you killed my six months of work on the RTOS, but I'm not complaining. Everytime I see a new posting by you I just KNOW it's gonna be soething that makes my life that little bit easier.

    A huge thanks and keep up the excellent work.

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


    Did you find this post helpful? Yes | No

    Default

    That's Great Sean!

    Always nice to know it's not going to waste.

    Hope it makes you money, or
    Impresses the boss, or
    Get's you an A+ on the project, or
    simply presserves the hair, so it can fall out naturally later.

    Best regards,
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Ioannis,

    Just in case you're still thinking, It can't be that (Post #89) because this works ...
    Code:
    while portb.0=1
    wend
    high led1
    If you look at the PORTB.0 diagram. You can see that it uses a TTL input buffer when reading PORTB as digital inputs. So, the High and Low voltage levels are 2.0V and 0.8V.

    With the circuit on the PICDEM2+ you'll get around 2.25V with the switch open (depending on the forward voltage of the LED). So it works fine with the digital Inputs.

    <img src=http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1800&stc=1&d=118290623 7>

    But the signal for the INT interrupt, goes thru a Schmitt Trigger. And it's levels are .8VDD (4V) High, and .2VDD(1V)Low.

    The circuits on PORTB.0 of the PICDEM2+ don't produce enough voltage to trigger the interrupt. (when the LED's are engaged)

    HTH
    Attached Images Attached Images  
    DT

  13. #93
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    Darrel, your suspicion of PICDEM2+ were confirmed! Damn, so many ours wasted over a stupid LED!

    Thanks for the help guys!

    Finally I decided to use the hardware direction about the log conversion to bargraph display. Faster, cleaner, wide dynamic, expensive!

    Thanks again.

    Ioannis

  14. #94
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi, Ioannis

    Have a look here ...

    http://pdf1.alldatasheet.com/datashe.../SSM-2110.html

    nice, but may be difficult to find ... and expensive.

    but worth it.

    I've also found an AOP and linearizing diodes solution, but won't give the dynamics and precision you look for ...

    Alain
    Last edited by Acetronics2; - 27th June 2007 at 14:48.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  15. #95
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    for non-french user, AOP= Op Amp
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #96
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Ioannis

    Have a look here ...

    http://pdf1.alldatasheet.com/datashe.../SSM-2110.html
    ...
    Alain
    Thanks Alain. I 'll stick to NE604, although more expensive than CA3089, because is operating on 5V directly and is great!

    Quote Originally Posted by mister_e View Post
    for non-french user, AOP= Op Amp
    I was wondering what AOP was! Thanks!

    Ioannis

  17. #97
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    Thanks Alain. I 'll stick to NE604, although more expensive than CA3089, because is operating on 5V directly and is great!
    You can use the SA605 (is more newer model than NE604) , and this is operating on 5-8V.

  18. #98
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    You can use the SA605 (is more newer model than NE604) , and this is operating on 5-8V.

    Thanks Nik. And a bit cheaper too!

    Ioannis

  19. #99
    Join Date
    Jan 2007
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    I've been playing with the NCD/DCD with excel, and there's something I can't seem to work in there.

    Granted, I'm relying on 30 year old memories from when I was working on microwave radios in the air force. But if memory serves me right, then a change of 3 db is double the power, and -3 db is half the power. And since the impedance is constant, it also means the voltage is either doubled or halved.

    So let's assume the signal is scaled so that the (maximum A/D reading +1) corresponds to +7 dbm. Then half of that would be 512 or +4 dbm.

    If you keep dividing that down, since there's only 10 bit's, you end up with a minimum of -23 dbm with an A/D input of 1.

    And it appears that it would take a resolution of 16-bits to be able to get down to -40 dbm.



    I think this applies to however you do it. Lookup, calculate, ...

    ADDED: And any noise or offset voltages will Obliterate the low end.

    But then, maybe I've got it all wrong? ??
    <br>
    I was always taught (having worked in the audo industry on digital mixin consoles, and having spent years designing synthesisers and samplers as a hobby) that the actual figure is around 6dB per bit, so 10 bits gives you 60dB, but in reality it's more like 4.5dB. I might be wrong but this is what I've always been told. Surely all you have to do is shift the levels?

  20. #100
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Sean_Goddard View Post
    I was always taught (having worked in the audo industry on digital mixin consoles, and having spent years designing synthesisers and samplers as a hobby) that the actual figure is around 6dB per bit, so 10 bits gives you 60dB, but in reality it's more like 4.5dB. I might be wrong but this is what I've always been told. Surely all you have to do is shift the levels?
    Look at http://www.picbasic.co.uk/forum/show...1&postcount=68. That one was solved!

    Ioannis

  21. #101
    Join Date
    Aug 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Question

    Hello!

    I've try to get some bar from this and I've got problem as usual ;-)


    So this is little code from me:
    INCLUDE "LCDbar_INC.bas" ' Include the BARgraph routines


    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 1
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 0
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50



    INPUT PORTA.0

    i var word


    LCDOUT $FE, 1 'clean screen

    while PORTA.0 = 0
    i = i+1
    LCDOUT $FE,2,"Value = ",DEC i," "
    ' syntax- BARgraph Value, Row, Col, Width, Range, Style
    @ BARgraph _Value, 2, 0, 16, 255, lines
    Pause 100
    wend


    As You can see in picture I've got problem when compiling with LCDbar_INC.bas...and get'+s lot lines of syntax error in INCLUDE file......off course I didn't make anything to this file...just copy -> paste....


    Do You know what couses this problem?
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Marin View Post
    ' syntax- BARgraph Value, Row, Col, Width, Range, Style
    @ BARgraph _Value, 2, 0, 16, 255, lines
    _Value should be _i in this case.

    The comments a little confusing at first, but once you figure it out, it just seems natural.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Hi Marin,
    To use Darrel's tidy little include files, you must place a copy of his file in the same directory as your code's file is in, and you must use MPASM as the assembler, not PM.
    JS
    Oh, and do they ever work sweet too!
    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.

  24. #104
    Join Date
    Aug 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default

    OK!

    Joe, is they any way to this be compiled in PM with some changes in .INCLUDE file?

  25. #105
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    If Darrel would make major changes it might!

    But then again why would he? MPASM is much better assembler!

    You still have your beloved compiler to write your code. Let Microchip do the job that knows better than anyone third.

    Ioannis

  26. #106
    Join Date
    Aug 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default

    GOnna go to MPLAB now.....

    Can somebody explain me using MPSAM with mine MicroCode Stuio PicBasic Pro?

    With that I still gona write code in code studio or?
    Last edited by Marin; - 8th August 2007 at 17:57.

  27. #107
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    No additional code.

    Just set up the Microcode Studio to use MPASM from View/Compile and Program Options/Assembler and check the Use MPASM checkbox.

    On your programmer set the fuses accordingly to your program/xtal

    Ioannis

  28. #108
    Join Date
    Aug 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default

    NOW, I download latest version of microcode studio and I'm using MPASM...and still have same problem....

    With other mine code MPASM works great without any mistake.....but when I try to put bar code rutine as INCLUDE it gives me many errors....

    Like YOu can saw on picture!!!!

    Only one strange thing occured:

    Everytime when I start CodeStudio.exe give me this message:

    The procedure entry point ThunkConnect32 could not be located in the dynamic link library KERNEL32.dll

    BUt, like I said...everthink wrks good with mine codes......

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


    Did you find this post helpful? Yes | No

    Default

    At this point, we can only guess.

    If you want to send the .LST file to me, I can take a closer look.

    Email to darrel at PBPgroup.com.
    It'll probably be too big to post in the forum.
    DT

  30. #110
    Join Date
    Aug 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default

    The problem is I don't have LST file......Ionly have LST file for code which is corectly assembled...for this no...when I try to assembled it it give me errors and stops.,

    And this is screenshot i forgot to send:
    Attached Images Attached Images  
    Last edited by Marin; - 9th August 2007 at 09:36.

  31. #111
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,796


    Did you find this post helpful? Yes | No

    Default

    It seems like the MPASM is not selected or not found.

    Have you installed MPLAB or at least the assembler?

    Can you send the program?

    Ioannis

  32. #112
    Join Date
    Aug 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default

    I did install MPASM and when I buil other code it works perfect and MPASM window pops up while compiling......so I think that's ok....

    Gonna try reinstall PICBASIC OR mpasM AND GONNA SEE.....

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


    Did you find this post helpful? Yes | No

    Default

    You might try downloading the LCDbar_INC.bas file again.

    I've heard a couple people say they got incomplete files on the first try.
    After downloading again it worked.

    The compiler is flagging errors, that should not be errors.
    A semicolon is the comment character. It should be ignored, not an error.

    What version of PicBasic Pro do you have?
    It is PicBasic Pro, right?
    Not PicBasic.
    <br>
    DT

  34. #114
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default

    Just a detail ...

    When installing MPLAB+ PbP ... some special instructions to care with !!!

    did you declare Paths to PbP AND to MPLAB, as specified ???

    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 " !!!
    *****************************************

  35. #115
    Join Date
    Aug 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default

    I downloaded code many times and always same problem remaining!

    Mecanique Micro Code Studio Plus
    Version 2.2.1.1
    Compiler Version is PicBasic Pro 2.30


    Yes....and MPASM is checked in complier options...and MPASM functioning ok with other codes!

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


    Did you find this post helpful? Yes | No

    Default

    PicBasic Pro 2.30 ??

    Well there's the problem.
    That's waaaaaayyy too old.
    Must have been at least 8 years ago.

    Time to buy a new version.
    <br>
    DT

  37. #117


    Did you find this post helpful? Yes | No

    Default

    Hi guys,

    does this work with a pic 16F84A ??

    I get many strange errors !

    .

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


    Did you find this post helpful? Yes | No

    Default

    Does it say something like "... Least significant bits used" ?

    If not, What errors are you getting?
    <br>
    DT

  39. #119


    Did you find this post helpful? Yes | No

    Default

    i've imported the folowing code from this thread:

    DEFINE OSC 4
    INCLUDE "lcdbarIN.bas"
    ' Set LCD Data port
    DEFINE LCD_DREG PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 4
    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTB
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 2
    ' Set LCD Enable port
    DEFINE LCD_EREG PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 3
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS 2000
    ' Set data delay time in us
    DEFINE LCD_DATAUS 100.

    DEFINE ADC_BITS 8 ' Number of bits in ADCIN result
    ADCON1.7 = 1 ' Right Justify AD result

    Value VAR WORD ' Must be a WORD even though AD is 8bit
    pause 1000
    LCDOUT $FE, 1, " "
    loop1:

    adcin 2,value

    LCDOUT $FE,2,"Value = ",DEC Value," "

    'syntax- BARgraph Value, Row, Col, Width, Range, Style
    @ BARgraph _Value, 2, 0, 16, 255, lines


    then i get :
    Error line 14: syntax error - this one i believe it's the ADCON1.7 = 1 command
    Warning Line 15: Bad token ";"
    bad expression
    Warning Line 16: Bad token ";"
    bad expression
    Warning Line 17: Bad token ";"
    bad expression
    Warning Line 18: Bad token ";"
    bad expression

    Note:
    The INCLUDE "lcdbarIN.bas" line where the name of the bas file is different because i also had to change to a smaller name due to "cannot include...etc" error

    .

  40. #120
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    mmm, as far as i know... grandpa 16F84 have no A/D converter ... so ADCIN will never ever works with... hence why you have some strange error... i missed that forum
    Last edited by mister_e; - 7th November 2007 at 23:19.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 20:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 20:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 17:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 27th June 2007, 00:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30

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