![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #16 |
|
Yep the dot means I programmed it. You have to push down pretty firmly on that machine socket. Since the Junebug sounds like it's ok, IMO it would be an excellent time to give the debug mode a spin. Add the two following lines to the beginning of your code (else the debug mode is really slow) movlw 0x72 movwf OSCCON This will speed up the PIC to 8MHz Then simply pick the debug mode instead of the program mode. You can single step , run , animate, set breakpoints and watch variables. TIP open a "watch" window and watch PORTB & TRISB You can toggle bits directly in this mode and see the results directly on the LEDs. | |
| |
| | #17 |
|
Ah ok. I will do that. I had a problem with only being allowed one breakpoint, and it was super slow, I assumed it ran by default on full speed.
| |
| |
| | #18 |
|
The default internal osc speed is 31.25 kHz, good for flashing LEDs but really slow for the debugger. I started out with a Parallax Clearview 5x ICE for the 16C54 way back before debuggers were available. | |
| |
| | #19 | ||
|
Hm, I get popups for stupid things, Quote:
Quote:
| |||
| |
| | #20 |
|
Hmm make sure DEBUG is enabled (from the MPLAB pulldown) and change TRISB bits 6&7 to 1. Code: movlw b'11100101' ;Proper port tris setup now (1 = input) movwf TRISB Last edited by blueroomelectronics; 24th July 2009 at 08:55 PM. | |
| |
| | #21 |
|
Same problem on the same line. Why are we setting those two bits as input? And not sure what you mean about debug enabled.. the debugger is connected if that's what you mean.
| |
| |
| | #22 |
|
Hmm, try adding DEBUG = ON to the CONFIG line.
| |
| |
| | #23 |
|
:s nothing's changed. This is bizarre
| |
| |
| | #24 |
|
RBPU needs to be cleared to enable the pullups. Here's a working version of the code and it worked with the debugger, just make sure the DEBUG pulldown is selected. Code: ; *** Junebug 18F1320 LED sequencer demo ***
; Flashes LEDs1 thru 6 from left to right forever
; DIP Switch (SW6) must have TUTOR on (SW6-1,2,3) all other switches off
list p=18F1320
include <p18F1320.inc>
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF
org 0x000 ; RESET vector
; INIT
INIT movlw 0x72 ; 8MHz OSC
movwf OSCCON
movlw 0x7F
movwf ADCON1 ; Set to all digital
movlw b'00111111'
movwf TRISA
movlw b'01111111'
movwf PORTA
movlw b'00100101'
movwf TRISB
bcf INTCON2,RBPU ; Enable pullups
MAIN btfss PORTB,RB2 ; is button #2 pressed?
goto LED3 ; yes?
LED4 movlw b'10000000'
movwf PORTA ; LED4 on, 3 off
goto MAIN
LED3 movlw b'01000000' ; RB2 pressed
movwf PORTA ; LED3 on, 4 off
goto MAIN
END
Last edited by blueroomelectronics; 27th July 2009 at 01:20 AM. | |
| |
| | #25 |
|
Hm, all seems to be working. Still not sure exactly what was going wrong but it's working now. Thanks so much for the help
| |
| |
| | #26 |
|
Actually I must have fucked up something soldering. Code: ; *** Junebug 18F1320 LED sequencer demo *** ; Flashes LEDs1 thru 6 from left to right forever ; DIP Switch (SW6) must have TUTOR on (SW6-1,2,3) all other switches off list p=18F1320 include <p18F1320.inc> CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF, DEBUG = ON org 0x000 ; RESET vector ; INIT INIT movlw 0x72 movwf OSCCON ; Speed the clock movlw 0x7F movwf ADCON1 ; Set to all digital movlw b'01111110' movwf TRISA movlw b'00000001' movwf PORTA movlw b'00100101' movwf TRISB bsf INTCON2,RBPU ; Set pullups MAIN btfss PORTB,RB2 ; Is button 2 pressed? goto LED6 ; Yes? movlw b'10000000' movwf PORTA goto MAIN LED6 movlw b'00000001' movwf PORTA goto MAIN END Any thing that you can think is likely to have been soldering improperly? I'm not wearing a wrist strap or anything but I can't really see it having that kind of affect. | |
| |
| | #27 |
|
You must change the bsf to bcf bcf INTCON2,RBPU to enable pullups or the buttons will not work properly. From MPLAB's debug, open a Watch window and watch PORTB, animate the program and press button #2 and you should see PORTB value changing. | |
| |
| | #28 |
|
OH post #2 says I could use bsf. works great. Thank you so much.
| |
| |
|
| Tags |
| junebug, led, pic |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Junebug Problem | 3v0 | Micro Controllers | 29 | 14th January 2009 09:16 AM |
| Problem with junebug and mplab 8.10 | jerryf | Micro Controllers | 12 | 1st December 2008 01:48 PM |
| Problem with junebug | jerryf | Micro Controllers | 6 | 30th November 2008 04:44 PM |
| Junebug INT2 problem | futz | Micro Controllers | 9 | 15th November 2007 03:32 AM |
| Junebug tutor LEDs | futz | Micro Controllers | 5 | 11th November 2007 05:24 AM |