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.

Junebug and USART

Status
Not open for further replies.

MrDEB

Well-Known Member
I discovered how to use the usart as a debugging tool BUT can only get it to work with the PIC on the Junebug
Have a ICSP pluged in between the Junebug and target project.
Have ALL the dip switches OFF
using Pickit2/ Junebug I write to target
When attempting to SEE what the target PIC is doing I get nothing.
Turning ON the TX dip I get wahats ON the Junebug PIC not the target.
Using the HELLO WORLD code but changing to HELLO DOUG
the Junebug has HELLO WORLD
What am I missing?
 
i think you need something like a max232 chip or two bugs connected and pickit 2 software.
i know its unrelated but..........regarding your bat box post..i was interested in the fact kids go a bit..."batty" with it. i have been looking for a news article that was on the the tv news in the uk a while back. apparently you can buy a device that shops are using that emits a noise teanagers and kids can hear but not adults, they are fitted above shop doorways etc to deter kids hanging around, from what i rem they are realy succesful but so far i cant find the article for you, i figured it might lead you to finding the frequency used so maybe you could bypass that one in your box.
 
Last edited:
The Serial Tool GUI has a diagram that shows you where to connect the TX pin to make it work. But know that it can not be that way when programming. You need a switch or jumper block.

If you look at the JB's schematic you can see how Bill did it.
 
Last edited:
In the .
 
I think I see what your talking about
The dip switch needs to be ON for the A3 port to be connected.
At least thats what I am thinking.
If this is the case then that explains why the sensor DS18B20 seems not to work.
 
other information .....
Under tools Menu in PicKit2 GUI


uart.jpg**broken link removed**
 
Last edited:
If this is the case then that explains why the sensor DS18B20 seems not to work.

You should only have switches 1 to 4 on for the DS18B20 to work. If you had switch 7 on then that would stop it working.

Mike.
 
The Serial Tool GUI has a diagram that shows you where to connect the TX pin to make it work. But know that it can not be that way when programming. You need a switch or jumper block.

I can successfully program with the TX switch in the on position.

Mike.
 
NO DISPLAY! why??

trying to learn the in's and outs of programing but keep getting road blocks.
The O.W DS18B20 problem may be related to this usart ?
Wrote some simple code to try and learn how to use the usart so as to insert into most any code to show visiually what the code is doing.
For example, the multiple tones that Pommie came up with using a RAND # GEN. Want to display the frequiencies selected as it progresses through the code.
Well the SIMPLE CODE does not work?
used the help file, added string.bas etc as per the Pomme code for the O.W.
Using same setup as for the O.W display (Junebug, first 4 dips on (same set up as the O.W. code writing.
Code:
evice = 18F1320
clock = 8 // 8MHz clock
config OSC = INTIO2, WDT = OFF, LVP = OFF

  // import modules...

include "USART.bas"

include "Convert.bas"

include "Utils.bas"     '<--------------------added


const ConstArray(2) as byte = (100, 200)

dim Index as byte

SetAllDigital           '<--------------------added

// display value to terminal program, include

// CR and LF

USART.SetBaudrate(br9600)

for Index = 0 to bound(ConstArray)

   USART.Write(DecToStr(ConstArray(Index)), 13, 10)   

next
 
Doing something WRONG?

first 3 dip switched ON
write to the Junebug the "Hello World.Hex"
Click on Pickit2/Usart tool/connect and Hello World displays
all dip switches OFF
do the same but now with all the dip switches OFF Junebug programs the daughter board PIC (18F1320)
Pickit2/Usart tool/connect NO DISPLAY
tried turning ON the TX dip switch but pretty sure the Junebug is outputting from the Junebug pic not the daughter board (I think I changed the text by one letter?
will check again.
 
if i have read your post correct................you are trying to display to the usart from another board not the junebug, is that correct?? from the very little i know (and it is a tiny amount!) you will have to power the circuit externaly not by the bug and connect the TX of the target chip to the RX of the bug and the RX of the target chip to the TX of the bug, sorry if i have totaly misread your post



on the 1320 the TX is pin 9 (RB1) Bottom left hand pin. RX is pin 10 (RB4) bottom right hand pin
 
Last edited:
That makes sense, externally power the daughter board.
Will give it a try but first need to find out what I need to do to power the daughter board without damage to the Junebug?
 
Hopefully this is correct?
from con8 pins 6 & 7 to daughter board pins 9 & 10 (18F1320)
and pin 8 to ground.
 
You should start reading and try to learn Basic. I have tried to help you but you haven't learnt anything. Start reading.

Mike.
 
ok i havnt tried this but i think it goes like this..................
power the daughter board from seperate source, but connect the Gnd with the Bug Gnd, then from the ICSP connector on the bug connect the pin thats marked PGC (this is RX also) to the TX pin (pin9) of the target chip and connect the PGD (this is TX) pin of the ISCP junebug connector to pin 10 of the target chip, make sure you dont have PGD and PGC connected to pins 12 and 13 of the target chip at the same time like you would do when programming the chip. i think you also need all the bug dip switches off but you might need to play with that. hopefuly if i have it wrong pommie or 3v will correct me.
 
I am learning as I go.
Have a pic basic book that I am trying to correlate with Swordfish
I appreciate all your help. I have learned about CONST and as far as the USART, still working on it.
After I sort out the USART I plan on insertin g into the random note generator code you posted then determine what frequiencies are getting selected and add more frequencies.
 
The reason you don't see anything is because by the time you run the uart tool your program has wandered off into random memory. You have a for...next loop which sends 100 followed by 200 and then nothing, not even something to stop it executing random memory.

Here's a "Hello World" program for the UART.
Code:
Device = 18F1320
Clock = 4           // 4MHz clock
Config OSC = INTIO2, WDT = OFF, LVP = OFF
include "USART.bas"

OSCCON = $62        // select 4MHz internal clock
ADCON1  = $7f       //all digital
INTCON2.7=0         //turn on WPUs
USART.SetBaudrate(br9600)
While true
    USART.Write("Hello World!", 13, 10)   
    delayms(500)
Wend
End
Note the while....wend loop that is always true and so will carry on forever.

Mike.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top