+ Reply to Thread
Page 3 of 4
First 1 2 3 4 Last
Results 31 to 45 of 57

Thread: So...I have my junebug....and Im totally lost

  1. #31
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,464
    Blog Entries
    11

    Default

    Quote Originally Posted by blueroomelectronics
    I've just started with C18, never needed C before. Hopefully 3V0 will post some code.
    Do you want to see code that lights a single LED or code that multiplexes LEDs to light more then one at a time.

    I have a series of programs that start with a single LED and end with multiplexing the LEDs using timers. I have posted some of the in the past. Maybe I need to get them collected in one place.
    Please post questions to the forums. PM's are for personal communication.

    BCHS/3v0's Tutorials
    Junebug USB PIC programmer kit., USB Bit Whacker,
    The 15 Minute Printed Circuit Board! (+drill time)


  2. #32
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,744

    Default

    how about both? First a single LED then Multiplexed LEDs using timers.

  3. #33
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,744

    Default

    just looked at the schematics for Junebug. I think i understand the process of high/low and the how it works. This is cool.

    What other BASIC programs can you use to program a pic in (freeware would be nice) just that as it being a hobby mostly im not trying to spend $150 to buy this program. I could buy a Junebug + Inchworm + Firefly for that price almost.
    Last edited by AtomSoft; 1st March 2008 at 02:41 PM.

  4. #34
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,464
    Blog Entries
    11

    Default

    Quote Originally Posted by AtomSoft
    how about both? First a single LED then Multiplexed LEDs using timers.
    I will try to collect them and publish them some place soon.
    Please post questions to the forums. PM's are for personal communication.

    BCHS/3v0's Tutorials
    Junebug USB PIC programmer kit., USB Bit Whacker,
    The 15 Minute Printed Circuit Board! (+drill time)

  5. #35
    Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent
    Join Date
    Mar 2005
    Location
    Brisbane Australia
    Posts
    6,805

    Default

    Quote Originally Posted by AtomSoft
    just looked at the schematics for Junebug. I think i understand the process of high/low and the how it works. This is cool.

    What other BASIC programs can you use to program a pic in (freeware would be nice) just that as it being a hobby mostly im not trying to spend $150 to buy this program. I could buy a Junebug + Inchworm + Firefly for that price almost.
    The Swordfish demo is pretty good as long as you don't use floats and do any string manipulation yourself. The Keyread and flash lights code above uses 39 bytes of ram, the demo allows upto 256 bytes.

    Mike.

  6. #36
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,744

    Default

    where does it say how many bytes of ram used? I get:
    39 Variable Bytes Used
    373 Program Bytes used

  7. #37
    Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent
    Join Date
    Mar 2005
    Location
    Brisbane Australia
    Posts
    6,805

    Default

    The variable bytes used is the ram used.

    Mike.

  8. #38
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,744

    Default

    I Assumed that since it was a dead on match lol

    I havent seen any basic examples like a how to. Some things newcomers might need/want to know.

    1. How to set (a) single/multiple port(s) to Input or Output.
    A.TRISA.7 = 1 ( This would set pin 7 on PortA to Input / 0 would be output)

    2. How to set a Pin High(on)/Low(off)
    A. High(PORTA.0) / Low (PORTA.0) // Set Pin 0 HIGH/LOW

    3. This code below sets pins 0, 6 and 7 to inputs (used as a big off(low) i think)
    TRISA.0 = 1
    TRISA.6 = 1
    TRISA.7 = 1


    My questions are:
    1. Is the above correct?
    2. INTCON2.7=0 //What exactly does this do? (interrupt maybe? or PortB something?)
    3. Config OSC = INTIO2, WDT = OFF, LVP = OFF
    4. ADCON1 = %11110101 // Sets what to digital PortA ? How is this layed out like pin to digit?
    5. OSCCON = $62 // 4 MHZ // But How is $62 = 4 MHZ ?
    6. Maybe i missed something but what sets PortB as inputs ? in the module?


    I know i ask alot of questions but its only to learn as not to be confused once i get my junebug.
    Last edited by AtomSoft; 1st March 2008 at 06:29 PM.

  9. #39
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,709
    Blog Entries
    5

    Default

    1. no, TRIS simply sets the direction of the port (In = 1, Out = 0)
    1a. LAT sets it high or low (so does PORT but LAT is better)
    1b. PORT is used for reading the state of an input pin
    2. INTCON2.7 should be written as INTCON2.NOTRBPU (same thing better syntax)
    3. CONFIG sets the PIC defaults on power up
    4. It's in the 18F1320 datasheet search for ADCON1
    5. also in the datasheet the upper nibble sets the clock, lower the options
    6. by default a port in Input and/ or Analog TRISA = %11111111 would set the entire port to input
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  10. #40
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,744

    Default

    So 1 was right because i wrote :
    A.TRISA.7 = 1 ( This would set pin 7 on PortA to Input / 0 would be output)
    and you wrote
    no, TRIS simply sets the direction of the port (In = 1, Out = 0)

    How would i use LAT then?

  11. #41
    Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent
    Join Date
    Mar 2005
    Location
    Brisbane Australia
    Posts
    6,805

    Default

    Quote Originally Posted by blueroomelectronics
    2. INTCON2.7 should be written as INTCON2.NOTRBPU (same thing better syntax)
    Bill,
    I looked for this in the 18F1320 include file and couldn't find it, infact, non of the bit fields are defined. I also just tried it and it doesn't work. Is there something I am missing?

    AtomSoft,
    Clearing INTCON2.7 turns on the weak pullup resistors on Port B.

    Mike.

  12. #42
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by Pommie
    Bill,
    I looked for this in the 18F1320 include file and couldn't find it, in fact, none of the bit fields are defined. I also just tried it and it doesn't work. Is there something I am missing?
    I've found quite a few errors like that in the Microchip include files. The 16F88 assembler include, in particular, is missing a lot of stuff and has many errors.

    I just fix the include file, using the datasheet as a reference. Add whatever is needed and correct the errors. Simple enough. An incorrect include is pretty annoying.
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  13. #43
    Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent
    Join Date
    Mar 2005
    Location
    Brisbane Australia
    Posts
    6,805

    Default

    Hi Futz,

    I was talking about the Swordfish include file. This doesn't contain any bit variables whatsoever and I'm not sure how to declare them.

    Mike.

  14. #44
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by Pommie
    Hi Futz,

    I was talking about the Swordfish include file. This doesn't contain any bit variables whatsoever and I'm not sure how to declare them.
    Oops! Never mind.
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  15. #45
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,709
    Blog Entries
    5

    Default

    Opps it's NOT_RBPU, I've use RBPU as it looks nicer IMO than NOT_RBPU
    Code:
    ;----- INTCON2 Bits ----------------------------------------------------
    NOT_RBPU        EQU  H'0007'
    RBPU            EQU  H'0007'
    INTEDG0         EQU  H'0006'
    INTEDG1         EQU  H'0005'
    INTEDG2         EQU  H'0004'
    TMR0IP          EQU  H'0002'
    T0IP            EQU  H'0002'
    RBIP            EQU  H'0000'
    
    From the 18F1320.inc file
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

+ Reply to Thread
Page 3 of 4
First 1 2 3 4 Last

Tags for this Thread