Cant get it to work


Closed Thread
Results 1 to 24 of 24

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I don't know, perhaps I'm way late here but your original program reads HIGH 0 and LOW 0 which may work on a BASICStamp but I don't think it works with PBP - even after including the BS1/2 defs - which you don't seem to have done anyway.

    Al, covered it in his program by changing the code to HIGH PORTB.0 etc but then in a later message you say you're using PORTB.4 instead. Did you change the code so it reads HIGH PORTB.4 etc?

    /Henrik.

  2. #2
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    I don't know, perhaps I'm way late here but your original program reads HIGH 0 and LOW 0 which may work on a BASICStamp but I don't think it works with PBP - even after including the BS1/2 defs - which you don't seem to have done anyway.etc?

    /Henrik.
    Good point,

    The original code doesn't even state what to high and low, what port, what variable etc. Barepawz can you post your entire code as it now stands?

    Given the suggestions, it should now set the config bits via the inc file, turn all ports digital, turn off A/D, and flash your LED.

    Oh and it's not advisable to drive a LED without any series resistor, this will allow the LED to draw as much current as it needs, which could be more than the PIC can provide. My EasyPIC5 board uses 1K resistors with "normal" 3mm defuse red LEDS, which work even though they shouldn't according to Al's formula, possibly as the forward current is probably 20ma rather then the 10ma used in the example. If you're using one of the Ultra-bright LEDS then use the formula in Al's post along with the data sheet for the LEDs you are using.

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


    Did you find this post helpful? Yes | No

    Wink Rt....

    Hi,

    This ( as ARatti finished it ) :

    Code:
    '****************************************************************
    '*  Name    : BPWZ.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 08/04/2010                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : 16F819                                                  *
    '*          :                                                   *
    '****************************************************************
    DEFINE OSC 8                                    ' 8 Mhz Oscillation
    OSCCON = $70                                    ' Oscilator Config reg.
    
    ADCON1 = 7
    
    TRISA = %00000000
    TRISB = %00000000
    
    PortA = 0
    PortB = 0
    
    start:
        High 0
        pause 1000
        low 0
        pause 1000
    goto start
    Makes PortB.0 blink @ 2 Hz ... Only if you use an external 8 Mhz Xtal ... as PBP Defaults to HS Osc for the Config. ( see #14 from Dave )

    you must add :

    Code:
     @ device PIC16F819,INTRC_OSC_NOCLKOUT, WDT_ON, PWRT_ON, MCLR_ON, protect_OFF, LVP_OFF
    to the top of the listing to get INTRC Oscillator work, if MCS using. Then no need to define the options by hand in IC Prog ...

    a look to manual $ 4.11 will show how "numbers only" work as port pins defining ...

    is the great mysterious code problem solved, now ???

    Alain
    Last edited by Acetronics2; - 8th April 2010 at 10:52.
    ************************************************** ***********************
    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. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hmm, I see I've completely missed (or perhaps forgotten) that HIGH 0 valid, you (re)learn something everyday. Still, I'd say it's "better" (not function wise but for readability) to actually say HIGH PORTB.0

    Thanks for pointing mo that Alain, let's hope the OP gets this going now!

    /Henrik.

  5. #5
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    Im at work right now so dont have access to the entire code. I did make this change to the main routine:

    Code:
    Start:
       PortB=0
       pause 500
       portB= $FF
       pause 500
    Goto start

    In theory this should toggle all the pins on portB. Unfortunatly, still getting a whole lot of nothing. Im prety sure there is either something wrong with fuse config (will look into the above suggestions when I get home tonight), or maybe its a hardware problem.
    Last edited by bearpawz; - 8th April 2010 at 15:56. Reason: added cide tags

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


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by bearpawz View Post
    will look into the above suggestions when I get home tonight
    I think It's much better ...

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

  7. #7
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    Well, I think at this point I have tried everything except brand new out of the tube microcontrollers. There is one factor in play here I didnt think of until just recent: Im using a very old laptop, and windows 98SE. I really dont think this is the problem but I have never had this kind of issue before so maybe it is. It appears to me as if the pic is being flashed correctly because I can flash test data into the EEPROM memory, and it will be read back correctly. It may be time to just break down and buy a better programming solution. For now Im sort of giving up.

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