Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

instructions for using junebug sim

Status
Not open for further replies.

MrDEB

Well-Known Member
as well as the pickit2.
I loaded the pickit2.exe file.
paste program into swordfish editor
then press F10
program starts doing something = compiling then says it loaded sucessfullt.
then it says the microcontroller needs to be reset
what now??
want to figure out this part before trying to run the Junebug simulator.
tried to figure out but get lost real quick -- couldn't find my bag of cookies crumbs to leave along the trail--lol or was it crackers??
 
You don't have your programmer installed Bill has how to do it In his junebug manual easy to miss but it's in there look on page 11 and make sure you do the 10 steps
1. View
2. Compile and Program Options
3. Install New Programmer
4. Create a custom programmer entry
5. Junebug
6. PK2CMD.EXE
7. Find automatically
8. /PPIC$target-device$ /F$long-hex-filename$ /M /R /H2
9. Finished
10. OK
 
have mplab etc installed

went to swordfish website and pretty sure I have everything in the right folder
In summary:

* Ensure either SESwordfish.exe or Swordfish.exe are present in your main Swordfish installation folder
* Copy SFBasic.mtc and TLSFBasic.ini into the MPLAB MTC Suites folder
* Run Swordfish.reg

I get "reset micro controller" error.
Is this because the Junebug is not actually installed?
need to review the manual as well as assemble the junebug kit I already have.
second questio?? I read this artical PIC microcontrollers : chapter 7 - Examples
and wondering if the code can be translated to go into the 18f1320 or will the junebug do a 16f84 pic??
sorry for all the questions but am chopping at the bit to learn and can't learn without asking.
 
It's and ideal to go by showing you how to get sound out of a pic. You can buy a 16f84 and program it with your junebug
microcontroller needs to be reset
what now??
swordfish does that when there no programmer or it not set up.
If your wanting to use mplab to sim what it's harder to do then program. I'll write you the code for the 18f1320 doing the same as PIC microcontrollers : chapter 7 - Examples I told you about that site so you could see how to set up your chip.
 
You get your sound from PORTB,3 And unzip the PW file and place it in your swordfish user Library. You put the PW.bas in the user library only. Here the code
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 3/31/2009                                                      *
*  Version : 1.0                                                            *
*  Notes   :     hook your sound up from PORTB.3                                                           *
*          :                                                                *
*****************************************************************************
}
Device = 18F1320
Clock = 8 // tells the compiler the FOSC speed
Config OSC = INTIO2, WDT = OFF, LVP = OFF
Include "Utils.bas"
Include "PW.bas"            // import PWM module..
Dim Duty As Byte
OSCCON = %01111111 // select 8MHz internal oscillator
SetAllDigital
// main program...
 PWM.SetFreq(5000)      //this set it for a 5000khz
 
 While true
   Duty = 40             // this starts it at 2000khz
   Repeat
      PWM.SetDutyPercent(Duty)
      Inc(Duty)
      DelayMS(25)
   Until Duty > 100        // takes it up to 5000
   Repeat
      PWM.SetDutyPercent(Duty)
      Dec(Duty)
      DelayMS(25)
   Until Duty = 40       // lower it back down

      
   Wend
 

Attachments

  • PW.zip
    1.2 KB · Views: 102
got the hello world compiled?

after following page 11 of 12 in the junebug assembly instructions and a few errors I got the program compiled.
BUT in the assembly instructions it shows a screen shot of pickit2 uart tool
I assume I need to actually have the Junebug connected??
And the code for the melodies from the link you suggested, do I test using a speaker ?? or a piezo sounder.
If a piezo tweeter will work then I will tray and get my 2 - 6 khz frequencies??
lots easier than the method I was attempting.
can the pic do to frequencies simultaneous back and forth?? or would I be better off asking for all of Berni Madeoffs assets--lol
Well I think I am already learning something, what I am not sure of but??
 
boy that was quick!!!

I guess this pic stuff is easier than I thought or your really sharp with this stuff??
thanks
now after compilling I am going to fiddle with it but would like to hear the results etc. see above post
 
how to check if it loaded the pw.bas?

I put that mod. in the swordfish library
I pressed F10 = no errors
pretty small program = 687 bytes, 48 variables
boy this is exciting. almost as good as Christmas
 
You can hook it up like this
 

Attachments

  • sound.PNG
    sound.PNG
    7.9 KB · Views: 152
Bill I was hoping so I never looked at that part of your circuit just the leds I love assembly and and so I tried your code and used the led part of the junebug I would buy one if I had
a job but work is slow right now.
 
The piezo speaker will have a sweet spot frequency where it's going to be the loudest.
Now RB.3 (or CCP1/PWM) can generate a frequency all by itself. It's a set and forget kind of thing.
Here's a Swordfish PWM module to wet your appetite.
Swordfish Wiki | SwordfishUser / PWM2 browse

The older PICBASIC Pro has a TONE command plus it can synthesize DTMF dual tones (like a touchtone phone) in software. So it's possible but I don't know the algorythm offhand. (Eric Smith wrote something like this if I recall)
http://www.brouhaha.com/~eric/pic/dtmf.html

Now it's in ancient 16C54 asm but when/if you decide to tackle asm you'll find the debugger really handy.

And of course Roman Blacks sound generation on a PIC (I recall 3V0 playing with this)
Official Home Page of the Roman Black
 
Last edited:
Bill He has that thats what I gave him there are 2 and when you down load them they have the same name so I change it because 1 works better on some chips like the 18f1330
 
That looks real good I have been wanting to use some thing like that on a robot I made
so it would sound like it said it not me lol
 
I have found some pic chips that where use in phone recorders they where locked.
 
It's actually a pretty impressive bit o code and all done within a single PIC. Now I wonder what could be done with a dsPIC!
I've rigged a 24H series 18pin PIC up and these little beasts do 40MIPs but have almost no pin drive power (4ma)

The book learning to fly with the 18F shows simple video generation on a PIC with code written in C.
 
Here's one more tidbit, the bootloader on your PK2 / Junebugs 18F2550 can be used for uploading custom firmware (and back to PK2 firmware) with just the press of a button. I've seen a PL2303 (USB to RS232) emulator and it works! also should be possible to use the Junebug as a sort of USB bit Whacker (less pins).

Ramble mode off :)
 
I tell you when i stop using the stamp I got some pic 32 from microchip samples. That's what I was going to start with never used them there so small I can't see the pins lol. They
have some real power
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top