I've done it again


Closed Thread
Results 1 to 17 of 17

Hybrid View

  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
    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

  4. #4
    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.

  5. #5
    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

  6. #6
    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.

  7. #7
    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.

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