I've done it again


Closed Thread
Results 1 to 17 of 17
  1. #1
    Join Date
    Mar 2008
    Posts
    79

    Default I've done it again

    I've been through the searches trying to find the answer to this, and have also googled it as well as trying to read the manual
    I'm trying to get an LCD to display something if both port C.1 AND port C.2 are high, but display something different if the ports are low
    my code is
    Code:
     IF PORTC.1 = 0 AND PORT C.2 = 0 then lcdout $FE,1,"test 1"
           If PORTC.1 = 1 AND PORT C.2 = 1 then LCDOUT $FE,1,"Test 2"
    I've tried all the usual by trying
    Code:
     IF (PORTC.1 = 0) AND (PORT C.2 = 0) then lcdout $FE,1,"test 1"
           If (PORTC.1 = 1) AND (PORT C.2 = 1) then LCDOUT $FE,1,"Test 2"
    and various other combinations
    Promise I'll try not to ask stupid questions again (for today anyway )
    Forgot to say I'm using PBPro 2.5 and Microcode Studio to assemble it, and Picflash to program, by the way I still cant find any way of setting OSC to HS I've tried various suggestions, and read the thread http://www.picbasic.co.uk/forum/showthread.php?t=543 but none work, I'm guessing its something to do with the rubbish Picflash program I'm using?
    Last edited by karenhornby; - 9th April 2008 at 17:11.

  2. #2
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    remove the space in the "port c.2"
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

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


    Did you find this post helpful? Yes | No

    Default

    Some PIC may have ADCs or else fancy multiplexed stuff on this port. You want to make sure they're disabled first, unless you will have some erratic results.

    I usually use something a little bit different
    Code:
    PORTC21Value=PORTC & 3 
    
    IF PORTC21 =1 then ...
    if PORTC21=2 then ...
    IF PORTC21=3 then ...
    This read the whole PORT in oneshot and may override some RMW issue.

    Make sure you have any kind of pull-up / down resistor in case you're reading PushButtons
    <hr>
    There's nothing bad with PicFlash. You need to set your config fuses in your code and when you import the .HEX file, it will import/change the Config Fuses for you.

    You can lauch PICFlash in MCS. You need to add a programmer in the list. View>>Compile and program option>> programmer and folllow the instructions.

    I use the following parameters line
    Code:
    -pPIC$target-device$ -f$hex-filename$ -e -w
    HTH
    Last edited by mister_e; - 9th April 2008 at 17:18.
    Steve

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

  4. #4
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JD123 View Post
    remove the space in the "port c.2"
    I should have been born a Blonde!
    Cant believe I'be been so stupid not to spot that
    Thanks

    BTW Tried solving the HS problem too by using @_config OSC_HS It assembles fine, but changed nothing when Picflash is run, Oscillator XT is still selected

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


    Did you find this post helpful? Yes | No

    Default

    because you're using PM to compile. use
    Code:
    @    device  pic16F877A, hs_osc, wdt_on, lvp_off, protect_off
    Steve

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

  6. #6
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    because you're using PM to compile. use
    Code:
    @    device  pic16F877A, hs_osc, wdt_on, lvp_off, protect_off
    Nope wont take it, comes up with WARNING 207 found label after colum 1.(device)
    and Error 122 illegal opcode (pic16f877A)
    BTW Tried
    Code:
     -pPIC$target-device$ -f$hex-filename$ -e -w
    but it just wont auto program with Picflash even when I put those paramaters in., does it manually fine but still have to change the XT to HS

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


    Did you find this post helpful? Yes | No

    Default

    Code:
    @    __CONFIG _HS_OSC & _LVP_OFF
    You must make sure you PGM jumper settings are right too.
    Last edited by mister_e; - 9th April 2008 at 17:35.
    Steve

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

  8. #8
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post

    You must make sure you PGM jumper settings are right too.
    Umm not to appear TOO blonde, but what Jumper settings?
    I'm using this easypic5 development board, with the Picflash programmer software and Microcode Studio version 3.0.0.5

    All I do is plug the USB cable into the board and program the chip?

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


    Did you find this post helpful? Yes | No

    Default

    I don't have the EasyPIC 5... but his ol' version 4

    let's see the programming jumper in the following PDF

    http://www.mikroe.com/pdf/easypic5/easypic5_manual.pdf

    look at page 12. PIC16F877A use RB5 for PGM, your jumper group (J10) must be set exactly as they show.

    and then you also have to make sure the Socket Selection one are also properly set. PDF page 13, figure 12.

    Next.. figure 14... MCLR as RESET.

    Next.. figure 15 OSC jumpers

    now you can also set your Pull-up/Down resistor with with your dip switches and jumper located on the right of your board.
    Steve

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

  10. #10
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    OMG Your a star
    It now programs as well as compiles and i dont have to start Picflash manually
    However I've still got the problem of trying to set hs_oscThe only way I can set it is manually with the picflash program, I cant find any way they Microcode studio will let me set it in the program

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


    Did you find this post helpful? Yes | No

    Default

    i suspect you have an overwrite error message?

    read again the thread i suggested.. post 5

    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.

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


    Did you find this post helpful? Yes | No

    Default

    euh, just to make sure of everything... notice the few spaces i've added between @ and __CONFIG...
    Steve

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

  13. #13
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    euh, just to make sure of everything... notice the few spaces i've added between @ and __CONFIG...
    Yep copied and pasted it to eliminate errors in my typing

    However your right, its coming up with Error[118] Overwriting previous address contents (2007)

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Steve

    Error 118 comes when using MPASM ( lower part of screen ) ... NOT PM ...

    So, config lines still have to be commented in the .inc files ...

    I just have set µCode here ...

    Seems Karen uses MPASM ...

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

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


    Did you find this post helpful? Yes | No

    Default

    Hence why i'd suggested to notice the space betwen @ and __CONFIG, the overwrite error message, and post #5 in the FAQ?

    'Stie d'franssā a marde
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    My two cents.

    karenhornby,
    Steve use to have in his signature something to the effect.

    "There are no problems, only learning opportunities"

    Do not worry about what may seem like a stupid question.
    We all have/had/will ask them
    Dave
    Always wear safety glasses while programming.

  17. #17
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Your all stars
    mister_e Sorry, I know you gave me the answer a couple of times, but I just couldn't get it for ages, tbh I actually never knew there were include files in the PBP folder duh!
    But I'm learning fast

    Thanks all

    now to the next problem..... lol
    to do with LCD scrolling., however I'll post the question in Darrel Taylor's thread about that

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