Please help...


Closed Thread
Results 1 to 17 of 17

Thread: Please help...

  1. #1
    Join Date
    Mar 2008
    Posts
    79

    Default Please help...

    I've done a stupid thing, I'm trying to learn how to program PIC's and thought I was doing well by getting a copy of PicBasicPro
    All every well, then I needed someway of programming the pic to try it out, so me being a smartass went and got the EasyPic5 development board as it included sockets for various Pic's and also came with a 2 X 16 LCD
    Great board, but it uses MikroBasic and unless you spend another £99 your limited to 2k in your program....ARGHH
    I Hate MikroBasic!
    I've been trying to get this working (untill I can sell the easypic5 board) by writing and compiling the program in PBP and then programming the pic on the easypic board by using the programming software that came with it
    btw if anyone wants an almost new Easypic5 board, contact me, it's going cheap and only used for this one thing!

    This SEEMS to work fine, but I've a problem.
    Going back to basics, I've tried writing the "Hello World" program, it compiles fine, seems to load fine but just wont display anything on the pic

    The Pic is a 16F677A with an 8Mhz xtal
    The LCD is connected on the board as follows:
    RS RB4
    RW Vss/Ground/0V
    E RB5
    D7 RB3
    D6 RB2
    D5 RB1
    D4 RB0



    Here is my code:
    Code:
    Code:
    'LCD DEFINATION*****************************************************************
    
    
            DEFINE LCD_DREG PORTB       ' Set LCD Data port
            DEFINE LCD_DBIT 0           ' Set starting Data bit (0 or 4) if 4-bit bus i.e, PortD.4-PORTD.7
            DEFINE LCD_RSREG PORTB      ' Set LCD Register Select port
            DEFINE LCD_RSBIT 4          ' Set LCD Register Select bit i.e, PORTC.5
            DEFINE LCD_EREG PORTB       ' Set LCD Enable port
            DEFINE LCD_EBIT 5           ' Set LCD Enable bit i.e, PORTE.4
            DEFINE LCD_BITS 4           ' Set LCD bus size ot 4 bit Upper Nibble (4 or 8 bits)
            DEFINE LCD_LINES 2         ' Set number of lines on LCD to 4 Lines
            DEFINE LCD_COMMANDUS 2000   ' Set command delay time in us
            DEFINE LCD_DATAUS 50        ' Set data delay time in us
    
    '*******************************************************************************
                         Pause 500       ' Wait for LCD to startup
    
    loop:   Lcdout $fe, 1   ' Clear LCD screen
            Lcdout "Hello"  ' Display Hello
            Pause 500       ' Wait .5 second
    
            Lcdout $fe, 1   ' Clear LCD screen
            Lcdout "World"
            Pause 500       ' Wait .5 second
    
            Goto loop       ' Do it forever
    What Am I doing wrong? I'm sure its something really stupidly simple but I've spent so much time on this its frying my brain!
    The board and LCD both work fine, I know because I've loaded several of the samples written already in Mikrobasic such as the one showing the lcd working and the temperature readout using the DS1820 both work fine.
    Last edited by karenhornby; - 9th April 2008 at 12:42.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    Hi, Karen

    1) you just should place a " DEFINE OSC 8 " to tell PbP you use a 8Mhz clock and then respect the LCD Timings.

    Note yo can use another 4 Mhz Xtal instead of the genuine 8 Mhz ...

    I think that simple thing will allow your LCD to work properly ...


    Considering your purchase ... why would it be an error ??? You can write and compile with PbP ( w. MPLAB or MICROCODE IDE ) ... and use EasyPic as a Programmer and Breadboard ...

    Just use directly " PicFlash" ( load HEX ) instead of opening MkE IDE ...

    Alain
    Last edited by Acetronics2; - 9th April 2008 at 13:05.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  3. #3
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Thanks for the suggestion, I changed the code to
    Code:
    DEFINE OSC 8
            DEFINE LCD_DREG PORTB       ' Set LCD Data port
            DEFINE LCD_DBIT 0           ' Set starting Data bit (0 or 4) if 4-bit bus i.e, PortD.4-PORTD.7
            DEFINE LCD_RSREG PORTB      ' Set LCD Register Select port
            DEFINE LCD_RSBIT 4          ' Set LCD Register Select bit i.e, PORTC.5
            DEFINE LCD_EREG PORTB       ' Set LCD Enable port
            DEFINE LCD_EBIT 5           ' Set LCD Enable bit i.e, PORTE.4
            DEFINE LCD_BITS 4           ' Set LCD bus size ot 4 bit Upper Nibble (4 or 8 bits)
            DEFINE LCD_LINES 2         ' Set number of lines on LCD to 4 Lines
            DEFINE LCD_COMMANDUS 2000   ' Set command delay time in us
            DEFINE LCD_DATAUS 50        ' Set data delay time in us
    but all I get is the same, a row of blocks on the 1st line of the LCD same as when you plug it in first with no program in the pic

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    GASP ...

    I've forgotten to tell you to set the OSC to HS ...

    and then ... works fine !!! ... on my Easy 5 !!!

    Alain

    PS, works also with OSC set to XT ( default ) ... IF there's problem ... check Hardware ...
    Last edited by Acetronics2; - 9th April 2008 at 13:34.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  5. #5
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    GASP ...

    I've forgotten to tell you to set the OSC to HS ...

    and then ... works fine !!! ... on my Easy 5 !!!

    Alain
    YAY Success
    Thanks I owe you one

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Talking

    One what ???
    ************************************************** ***********************
    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 " !!!
    *****************************************

  7. #7
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    A drink:P

    Is there any way of setting the OSC to HS in the program itself rather than having to change it on the programmer each time?

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


    Did you find this post helpful? Yes | No

    Default

    Depends on the IDE you're using ...

    For MPLAB :

    Code:
     @    __config _HS_OSC
    For µCode Studio

    Code:
    @   DEVICE pic16F877a,HS_OSC
    Alain
    Last edited by Acetronics2; - 9th April 2008 at 14:40.
    ************************************************** ***********************
    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. #9
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Depends on the IDE you're using ...
    MicroCode Studio

  10. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    sooooo,

    For µCode Studio

    Code:
    @   DEVICE pic16F877a,HS_OSC
    Regards
    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 " !!!
    *****************************************

  11. #11
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Its really wierd...
    It wont accept that or any of the other suggestions, the only way I could get the HS_OSC in the code so it produced no errors was to use DEFINE pic16F877a,HS_OSC
    However, although this gives no errors when you compile it, when you try and program it using Picflash it still sets Oscillator to XT and not HS
    guess i'll just have to keep an eye on it and change it whenever I program it

  12. #12
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    DEFINE only sets PbP internal values ... doesn't deal with Pic Registers.

    I think there is a consistent thread about that on the Forum, Written by Melanie.

    A SEARCH will be welcome ...

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

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


    Did you find this post helpful? Yes | No

    Default

    From post 1 to 5

    Presetting Configuration Fuses (PIC Defines) into your Program
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Steve

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

  14. #14


    Did you find this post helpful? Yes | No

    Default

    "I've been trying to get this working (untill I can sell the easypic5 board)"

    Why sell ?
    PicFlash is one of the fastest programmers out there, EP5 one of the most versatile dev boards you can find.

    You just need to figure out how to use it properly :-)

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


    Did you find this post helpful? Yes | No

    Default

    Seems the problem have been solved in another thread.
    http://www.picbasic.co.uk/forum/show...?t=8501&page=2
    Steve

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

  16. #16
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Seems the problem have been solved in another thread.
    http://www.picbasic.co.uk/forum/show...?t=8501&page=2
    Whoops, sorry should have said here b4 now that it's been sorted

  17. #17
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Is the EasyPIC5 still for sale?

    Quote Originally Posted by karenhornby View Post
    btw if anyone wants an almost new Easypic5 board, contact me, it's going cheap and only used for this one thing!
    It is available and still for sale, I would be interested. If still for sale, how much?
    Drop me an email at [email protected].

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