+ Reply to Thread
Results 1 to 8 of 8

Thread: Junebug / ICD

  1. #1
    MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent
    Join Date
    Apr 2007
    Posts
    2,132

    Default Junebug / ICD

    how does one test out some code using a Junebug connected with the con2 port and a 5 cond ribbon cable to a board w/ several LEDs and a PIC.
    can program the PIC but running a test of the board and the LEDs (current draw total = 30ma, using large resistors)
    probally should have stuck this post in the Junebug help but that post is getting way toooo long.
    lots of info and help in that post.


  2. #2
    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,702
    Blog Entries
    5

    Default

    Download the Inchworm quick start poster in my Download section. Junebug & Inchworm connect to target projects the same way, same signals as the PICkit2 or ICD2.
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  3. #3
    MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent
    Join Date
    Apr 2007
    Posts
    2,132

    Default thanks bill will give it a try

    trying to include a sub program but keep getting error
    unable to open file

  4. #4
    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,702
    Blog Entries
    5

    Default

    Which error, what program?
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  5. #5
    MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent
    Join Date
    Apr 2007
    Posts
    2,132

    Default trying to merg these two together

    Code:
    // 18F1320@ 8MHz - they are just used here for clarity...
    Device = 18F1320
    Clock = 8
    
    Include "ISRTimer.bas"          
    
    // constant ID to 4 * 16 bit timers...
    Const
       Timer1 = 0,
       Timer2 = 1,
       Timer3 = 2,
       Timer4 = 3
          
    // OnTimer1 event...
    Event OnTimer1()
       Toggle(PORTB.0)//pin 8
    End Event
    
    // OnTimer2 event...
    //Event OnTimer2()
     //  Toggle(PORTB.1)// pin 9
    //End Event
    
    // OnTimer3 event...
    //Event OnTimer3()
      // Toggle(PORTB.2)//pin 17
    //End Event
    
    // activate the timer module...
    Timer.Initialize
    
    // initialise the timers - refresh every 1000Hz (1ms)...
    Timer.Items(Timer1).Interval = 5        // 50ms
    Timer.Items(Timer1).OnTimer = OnTimer1   // timer event handler
    //Timer.Items(Timer2).Interval = 10       // 250ms
    //Timer.Items(Timer2).OnTimer = OnTimer2   // timer event handler
    //Timer.Items(Timer3).Interval = 15       // 500ms
    //Timer.Items(Timer3).OnTimer = OnTimer3   // timer event handler
    Timer.Items(Timer4).Interval = 2000      // 2000ms, no event handler
    
    // enable the timers...
    Timer.Items(Timer1).Enabled = true
    //Timer.Items(Timer2).Enabled = true
    //Timer.Items(Timer3).Enabled = true
    Timer.Items(Timer4).Enabled = true
    
    // start processing all timers...
    Timer.Start
    
    // main program loop...
    While true
       // this is a polled timer, not event driven - check to see
       // if it has timeout...
       If Not Timer.Items(Timer4).Enabled Then
          Toggle(PORTB.1)//pin 9
          
          DelayMS(2)
          Toggle(PORTB.1)//pin 18
          Timer.Items(Timer4).Enabled = true//runs for 15 minutes2000ms
       EndIf
          
      
    Wend
    
    Code:
    }
    Device = 18F1320
    Clock = 8 // 8MHz clock
    Config OSC = INTIO2, WDT = OFF, LVP = OFF
    Include "timermodule4.bas"
    
    Dim NOT_RBPU As INTCON2.7
    Dim TMR1IE As PIE1.0
    Dim TMR1IF As PIR1.0
    Dim TMR1 As TMR1L.AsWord
    Dim Speaker As PORTB.3
    Dim SpeakerTris As TRISB.3
    
    Dim Amp As PORTB.1 // turns on amp power
    Dim AmpTris As TRISB.1//turns on amp pin 9
    Dim Speed As Word
    Dim dip1 As PORTA.0
    
    Dim dip2 As PORTA.1
    
    Dim dip3 As PORTA.2
    
    Dim dip4 As PORTA.3
    
    Dim dipRD As PORTB.0
    
    //global variables
    Dim Seed As LongWord, Tone As Byte
    Dim i As Byte
    
    //half period delays = clock speed divided by 2*frequency
    Const Tones(18) As Word = (2000000/12000,2000000/10000,2000000/8000,2000000/6000,2000000/4000,1000,
    2000000/12000,2000000/10000,2000000/8000,2000000/6000,2000000/4000,1000,2000000/12000,2000000/10000,2000000/8000,2000000/6000,2000000/4000,1000)
    
    //interrupt routine
    Interrupt MyInt()
              T1CON.0=0 //stop timer
              TMR1=-Tones(Tone) //reset period
              T1CON.0=1 //restart timer
    If Tone=5 Then //if silence
       Speaker=0 //speaker off
    Else //otherwise
    Toggle(Speaker) //make sound
    
    EndIf
    TMR1IF=0 //clear interrupt flag
    End Interrupt
    
    Function Rand(Range As Byte) As Byte
    Dim i As Byte, feed As Bit, temp As Word
    For i = 0 To 7 //generate 8 bits
        Feed = Seed.30 Xor Seed.27 //make new bit
        Seed=Seed*2+Feed //shift seed left and add new bit
    Next
        Temp=(Seed And 255) * Range //change Rand from 0 to 255
        Rand = Temp/256 //to 0 to (Range-1)
    End Function
    
    //main code starts here
    
    
          
    
    
    //main code starts here
    
           OSCCON = $72            //select 8MHz internal clock
           NOT_RBPU=0              //WPUs on port B
           ADCON1=$7f              //all digital
           TRISB.0=0               //make output
           PORTB.0=1 //makes pin 8 high for dip switches
           T1CON = %10000001       //pre=1
           T1CON = %10000001 //pre=1
           Tone=5 //no sound please
           TMR1IE=1 //enable timer 1 interrupt
    Enable(MyInt) //set interrupt going
    SpeakerTris=0 //Setup Port
    Seed=$12345678 //seed random number
            TRISA =%00001111          //sets your inputs on porta 
    While(TRUE) //repeat forever
    
        If dip1=1 Then //dip1 pin 1
           Speed=25
        EndIf
        
        If dip2=1 Then // dip 2 pin 2
           Speed=50 
        EndIf
        
        If dip3=1 Then //dip3 pin 6
           Speed=75
        EndIf
        
        If dip4=1 Then //dip4 pin 
           Speed=Rand(10)*15+15    //Speed = 25 to 250 random select speed
           
        EndIf
    PORTA.0=1  
    If PORTB.1=0 Then //if button 1 pressed add PIR=1 here pin 9
    For i = 1 To 200 //play 20 tones
        Tone=Rand(5) //each tone is random frequency
    DelayMS(Speed) //and for 1.00 seconds
    Next //end for loop
    Else //otherwise
         Tone=5 //silence
         i=Rand(255) //make rand more random
          PORTA.0=0
    EndIf //end if condition
    Wend //end of while loop
    
    the first is the timer and the second is the random sound code.
    the timer times for about 20 minutes between triggering pin 9 of the 18F1320

    maybe because I have the first few lines the same?(the osc and device etc?)
    this basic stuff is a lot to learn

  6. #6
    MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent
    Join Date
    Apr 2007
    Posts
    2,132

    Default error message

    after hitting F12 I get {unable to open timermodule4 file}

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

    could it be that "}" on the top?

    or maybe is it in the same directory?

    or is the filename too long?
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

  8. #8
    MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent MrDEB Excellent
    Join Date
    Apr 2007
    Posts
    2,132

    Default Both load seperatly just fine

    its when I put the INCLUDE "timermoduel4.bas" into the first program.
    will try and shorten the file name.

+ Reply to Thread

Similar Threads

  1. Junebug help??
    By MrDEB in forum Micro Controllers
    Replies: 565
    Latest: 17th February 2010, 12:33 PM
  2. help with junebug
    By mrwhitee in forum Micro Controllers
    Replies: 34
    Latest: 7th June 2009, 11:37 PM
  3. JUNEBUG on its way
    By MrDEB in forum Electronic Projects Design/Ideas/Reviews
    Replies: 7
    Latest: 25th March 2009, 03:02 AM
  4. IR with junebug
    By AtomSoft in forum Micro Controllers
    Replies: 5
    Latest: 16th March 2008, 02:02 PM
  5. bra & WDT Junebug
    By AtomSoft in forum Micro Controllers
    Replies: 17
    Latest: 3rd March 2008, 02:51 PM

Tags for this Thread