New to PIC


Closed Thread
Results 1 to 21 of 21

Thread: New to PIC

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Not sure. But if it can take a HEX file and send it to the PIC then it should. Does it come with software?
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jul 2009
    Location
    Ohio, USA
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    No software, but I can use MPLAB/swordfish to program it so...it should work.
    I will know when I get the package.

  3. #3
    Join Date
    Jul 2009
    Location
    Ohio, USA
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    Ok so I got the PICBasic pro compiler today and am having trouble with PORTA on the PIC18F1320.

    I have 6 charlieplexed leds on Porta.0, Porta.6 and Porta.7 as seen here http://www.blueroomelectronics.com/d...structions.pdf

    I cannot get a led to light on PORT6 or 7

    Here is my code
    ADCON1 = 127
    input porta.7

    led var porta.0
    sink var porta.6
    low sink
    loop:
    pause 5
    toggle led
    pause 5
    toggle sink
    goto loop
    end

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


    Did you find this post helpful? Yes | No

    Default

    Hi Mike, Welcome to the forum. You have analog stuff to turn off on PortA.
    ADCON0 = 0 'disable A/D module disabled
    ADCON1 = 127 'AN1 through AN6 as digital
    Hmmm no CMCON or CMCON0 . . . . still looking . . . .
    Ok now I looked at the Data sheet on the junebug. PortA is used as outputs, so let's start here:
    Code:
    ADCON0  = 0 'disable A/D module disabled       
    ADCON1  = 127 'AN1 through AN6 as digital 
    DEFINE OSC 4 ' or some other number as fits you
    
    PortA = %00000000 ' a zero for each pin drives LATA registers all low so when made an output they will all be @ ground
    TRISA = %00000000 ' All portA pins as outputs
    PortA = %10000001 , Light 1 on
    Pause 200
    TRISA.7 = 1 ' Tristates PortA.7 
    PortA = %01000000 'Light2 on
    pause 200
    TRISA = %00000001 ' Tristates RA0
    portA = %01000000 ' Light3 on
    and so on, here is untested code
    Different methods shown above.
    A better way might be to use 2 lookup tables and a for next loop to display this somewhat unusual LED Array.
    Code:
    ADCON0  = 0 'disable A/D module disabled       
    ADCON1  = 127 'AN1 through AN6 as digital 
    DEFINE OSC 4 ' or some other number as fits you
    TrisVar Var Byte
    PortVar Var Byte
    index   Var Byte
    PortA = %00000000 ' a zero for each pin drives LATA registers all low so when made an output they will all be @ ground
    TRISA = %00000000 ' All portA pins as outputs
    main:
        For index = 0 to 5
    
            lookup index,[%00000000,%00000000,%00000001,%00000001,%01000000,%01000000], TrisVar
            lookup index,[%00000001,%01000000,%01000000,%10000000,%10000000,%00000001], PortVar
            PortA = PortVar
            TrisA = TrisVar
            Pause 200
        next index
    GoTo Main
    end
    Last edited by Archangel; - 25th July 2009 at 07:11.
    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.

  5. #5
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    You need to set internal oscillator because you use porta.6 and porta.7 as I/O.
    See page 17 on datasheet of pic18f1230.

  6. #6
    Join Date
    Jul 2009
    Location
    Ohio, USA
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    Thanks for the input guys, still no luck with the program, maybe its the Junebug... I don't know. Any other suggestions?

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


    Did you find this post helpful? Yes | No

    Default

    If you think it might be the "June bug" try a simple hardware setup with one LED on a non analog pine and see it you can make it blink.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. Replies: 67
    Last Post: - 8th December 2009, 02:27
  3. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  4. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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