Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 29th January 2008, 05:54 PM   (permalink)
Default

Quote:
Originally Posted by Krumlink
Hey bill how do I get the demo to work? Do i follow the directions on the Hello world poster but instead put in its code?
You mean the blinky program at the back of the Junebug manual?
Yes the instructions on the poster mostly apply, the poster is for version 7.x where 8.x has a release (normal) and debug selector on the toolbar but is otherwise similar to 7.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Old 31st January 2008, 11:09 PM   (permalink)
Default

Hey guys...

Just finished assembling my Junebug today, and I don't think its working quite right. I followed the directions to a T, and everything is identical to the picture. When I hook up to the USB cable, the green and yellow leds come on and the 3rd larger led comes on and goes off. I don't know where to start?
thekyguy11 is offline  
Old 31st January 2008, 11:11 PM   (permalink)
Default

o, and it shows 3.98 volts across U5V and GND
thekyguy11 is offline  
Old 31st January 2008, 11:33 PM   (permalink)
Default

Quote:
Originally Posted by thekyguy11
Hey guys...

Just finished assembling my Junebug today, and I don't think its working quite right. I followed the directions to a T, and everything is identical to the picture. When I hook up to the USB cable, the green and yellow leds come on and the 3rd larger led comes on and goes off. I don't know where to start?
That sounds normal. LED 3 will come on when the 18F1320 is blank. The green & yellow are normal and the red may flash. Run the PICkit2 standalone software availabe in the PICkit 2 section of Microchips site.
3.8V seems too low though. Is that measured with a multimeter?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Old 1st February 2008, 12:43 AM   (permalink)
Default

o, so it is working, lol.

Yes, the voltage was measured with an old Fluke Multimeter. The only things I questioned during assembly was L1. All that was left that could go there was what looked like a larger resistor (1/2 watt?) than the rest. I think the colors were wrong for R6 also, but when I measured resistance of the one I installed in R6 it matched what the directions called for. Could either of these cause the low voltage?

Last edited by thekyguy11; 1st February 2008 at 12:45 AM.
thekyguy11 is offline  
Old 1st February 2008, 12:47 AM   (permalink)
Default

Yep the "large resistor" is a big inductor. remove both PICs from the PCB and test the voltage again.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Old 1st February 2008, 05:49 AM   (permalink)
Default

5.07 volts with both PICs removed. Is that normal?

edit: I just reinserted the PICs, and I noticed I have the dip switches in backwards compared to the picture in the manual. I set them up like the picture and re-checked voltage and got 5.04v . I'm assuming everything is good now?

Last edited by thekyguy11; 1st February 2008 at 05:57 AM.
thekyguy11 is offline  
Old 1st February 2008, 06:25 AM   (permalink)
Default

Quote:
Originally Posted by thekyguy11
5.07 volts with both PICs removed. Is that normal?

edit: I just reinserted the PICs, and I noticed I have the dip switches in backwards compared to the picture in the manual. I set them up like the picture and re-checked voltage and got 5.04v . I'm assuming everything is good now?
Just get on with it and program a PIC! Then you'll know. Measuring it for a day will get you nowhere.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is online now  
Old 1st February 2008, 06:41 AM   (permalink)
Default

Make sure the PICs are in the right way round.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now  
Old 1st February 2008, 07:11 PM   (permalink)
Default

yea, they were in correctly..

Anyways, I was able to get the demo where LED 4 flashes, and then I got the chasing LED to work. Everything was great...But, when I tried to change the code for the chasing LED one, it looked kinda goofy, so I tried to re-load the blinky.asm that you provided. For some reason it acts like LED 2 and LED 5 are backwards. When I erase using the pickit2 software and it sits idle, LED 3 kinda dimly flickers on and off like one of those fake candle bulbs you see at christmas time. I tried deleting everything I created off the computer and starting from scratch with fresh code, but it still won't "chase" properly.

I wouldn't really care, but I feel like it could be a hardware issue.
thekyguy11 is offline  
Old 1st February 2008, 07:28 PM   (permalink)
Default

It sounds like it's fine. LED3 will flicker on a blank 18F1320 because the 18F1320 thinks it's an oscillator and an LED can act as a cap, moving your hand near it or touching it will stop it from happening.
Charlieplexing LEDs can be a little daunting.
Here's the Blink program Swordfish BASIC and the module for the Junebugs LEDs. Swordfish .hex files can be loaded using the PICkit2 standalone software or programmed directly using PK2CMD.EXE

Edit rewritten module using High(x) and Low(x) commands.

Blinky Swordfish BASIC SE for the Junebug
Code:
{
*****************************************************************************
*  Name    : BLINK_1.BAS                                                   *
*  Author  : William Richardson                                             *
*  Notice  : Copyright (c) 2008 blueroomelectronics                         *
*          : All Rights Reserved                                            *
*  Date    : 1/7/2008                                                       *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
Device = 18F1320
Clock = 4               // 4MHz clock
Include "junebug.bas"
Dim Count As Byte
While True
    For Count = 0 To 6
        LED(Count)
    DelayMS(300)        // delay in 1000s of a second
    Next
Wend        // repeat forever
End
And the module (just save it like any other program)
Code:
{
*****************************************************************************
*  Name    : JUNEBUG.BAS                                                    *
*  Author  : William Richardson                                             *
*  Notice  : Copyright (c) 2008 blueroomelectronics                         *
*          : All Rights Reserved                                            *
*  Date    : 2/1/2008                                                       *
*  Version : 0.91beta                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}

Module Junebug
Device  = 18F1320
Public Sub LED(x As Byte)
  Select x
    Case 1      // LED 1
    TRISA.0 = 0
    TRISA.6 = 0
    TRISA.7 = 1
    High(PORTA.0)
    Low (PORTA.6) 
    Case 2      // LED 2
    TRISA.0 = 0
    TRISA.6 = 0
    TRISA.7 = 1
    Low (PORTA.0)
    High(PORTA.6)      
    Case 3      // LED 3
    TRISA.0 = 1
    TRISA.6 = 0
    TRISA.7 = 0
    High(PORTA.6)
    Low (PORTA.7)      
    Case 4      // LED 4
    TRISA.0 = 1
    TRISA.6 = 0
    TRISA.7 = 0
    Low (PORTA.6)
    High(PORTA.7)      
    Case 5      // LED 5
    TRISA.0 = 0
    TRISA.6 = 1
    TRISA.7 = 0
    Low (PORTA.0)
    High(PORTA.7)      
    Case 6      // LED 6
    TRISA.0 = 0
    TRISA.6 = 1
    TRISA.7 = 0
    High(PORTA.0)
    Low (PORTA.7)      
  Else          // All LEDs Off 
    TRISA.0 = 1
    TRISA.6 = 1
    TRISA.7 = 1

  End Select
End Sub
Config OSC = INTIO2, WDT = OFF, LVP = OFF
ADCON1  = %11110101
OSCCON = $62            // 4 MHz clock
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com

Last edited by blueroomelectronics; 1st February 2008 at 08:22 PM.
blueroomelectronics is online now  
Old 1st February 2008, 07:48 PM   (permalink)
Default

I love how quickly you reply!

It took a minute, but I figured out how to get that to work using swordfish. Much easier than MPLAB in my opinion. But if they are supposed to be chasing in order, they aren't. It goes... 1-3 and 5 together-3-4-5-6, 2 never even lights. What am I doing wrong?
thekyguy11 is offline  
Old 1st February 2008, 07:59 PM   (permalink)
Default

Does the assembly version in the manual work fine for you?
Try to turn the LEDs on one at a time, I'll repost with a modified Junebug module. Swordfish is very nice, I just started playing with their new LCD plugin.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com

Last edited by blueroomelectronics; 1st February 2008 at 08:03 PM.
blueroomelectronics is online now  
Old 1st February 2008, 08:10 PM   (permalink)
Default

It did work, but only the first time. For some reason, it seems like ever since I changed the assembly code, it wont work right. I was going to ask how to turn them on one at a time, but you beat me to it. Seems like a good troubleshooting technique.
thekyguy11 is offline  
Old 1st February 2008, 08:20 PM   (permalink)
Default

Hmm sounds like a config problem, try adding
Code:
Config OSC = INTIO2, WDT = OFF, LVP = OFF
The MPASM and C18 allow for debugging, you can even toggle the pins in a watch window. So try watching TRISA & PORTA with the debugger running and the .asm blinky. You can single step, set breakpoints and toggle the I/O directly. Makes coding for PICs very easy to understand.
Swordfish does not have debug support but is otherwise excellent and I even like its IDE

Edit refresh your browser, I've rewritten the Junebug module with the High & Low pin commands.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com

Last edited by blueroomelectronics; 1st February 2008 at 08:23 PM.
blueroomelectronics is online now  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Junebug kit ready, (PICkit2 & tutor) blueroomelectronics Micro Controllers 37 28th October 2007 03:47 AM
Assembly? Marks256 Micro Controllers 43 28th July 2006 04:45 PM
Assembly compiler Thunderchild Micro Controllers 4 12th March 2006 02:25 PM
Learning Assembly Programming Language Johnson777717 Micro Controllers 4 22nd March 2004 03:00 PM
Assembly Language Question Jeggyman General Electronics Chat 6 30th January 2004 10:54 PM



All times are GMT. The time now is 08:56 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker