|
|
View previous topic :: View next topic |
Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9081 Location: Greensville,Ontario
|
|
Posted: Fri Mar 01, 2019 12:17 pm |
|
|
good idea but...restore only goes back 1 day !!! unlike the XP version which I believe is/was daily. Thing is I've installed/upgraded stuff like antivirus and browser so you'd think Windoze would trigger on those 'events' and create 'restore points'.
oh well...
MPLAB seems to be OK, it's CCS that may be the fiddle here. Doing stuff inside MPLAB, like read/burn PICs is OK..no errors/crashes/viloations....
It'd be nice to just copy/paste the XP PICC into W7 seeing how I can't locate the flashdrive with CCS on it...or the old HD it 's on.
gremlins....
at least the XP system confirms I can program the 12f1822. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Fri Mar 01, 2019 1:24 pm |
|
|
As I have already said, try building with CCS without involving MPLAB. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9081 Location: Greensville,Ontario
|
|
Posted: Fri Mar 01, 2019 5:41 pm |
|
|
Finally some good news. I can program PICs again ! Well I can blink an LED on a 12F683. I 'think' W7 somehow trashed CCS compiler 'stuff', cause MPLAB was OKish...I totally removed one way or the other EVERY file that was CCS related (10,136 not that I counted...). Cleaned out the trash bin, registry had a lot of 'weird' stuff, cleaned up the HD somewhat, found the 'update.exe' on a 40G HD in the basement, installed and now it works. I have no idea what went wrong BUT right now I had to login here and THAT hasn't been necessary for years, maybe a couple gremlins are still lurking. At least I have copies of all recent program sources on 2HD and 2 FDs. So nearly 4 days lost......all cause I wanted to 'play' with a new 8 pin PIC !
I should've stayed with my 46K22 !
Thanks for the support.
Update: still no joy but I can program the 1822. PCM is 4.114, newest version I can find though I have 4-6 more HDs to look at. Using the internal 4MHz clock, clkout (pin3) IS 1us, which it should be, so PIC is running at correct speed. Scope shows 40us high, 40us low when it should be 500ms, 500ms. Changing delay value does change pulses. ALL output pins do the same. So..... I'm back where I was a week ago. I'll dump the listing and 'play computer' and count the 'delay_ms(500)' cycles. It looks like a simple loop in a loop + trim chunk of code. The 683 works fine BTW.
Yeesh I haven't does ASM since V2.534.....
Jay |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9081 Location: Greensville,Ontario
|
|
Posted: Sat Mar 02, 2019 7:20 am |
|
|
Code: |
*
0000: MOVLP 00
0001: GOTO 018
0002: NOP
.................... //12F1822 version
.................... //12F683 version works 100%
.................... #include <12F1822.h>
.................... //////// Standard Header file for the PIC12F1822 device ////////////////
.................... #device PIC12F1822
.................... #list
....................
.................... #fuses INTRC_IO,NOWDT,NOPUT,NOPROTECT,MCLR,put
.................... #fuses CLKOUT,NOLVP //clkout is 1us
....................
.................... #use delay(clock=4Mhz) //1us per instruction
0003: MOVLW 06
0004: MOVWF 04
0005: MOVF 00,W
0006: BTFSC 03.2
0007: GOTO 016
0008: MOVLW 01
0009: MOVWF 21
000A: CLRF 20
000B: DECFSZ 20,F
000C: GOTO 00B
000D: DECFSZ 21,F
000E: GOTO 00A
000F: MOVLW 4A
0010: MOVWF 20
0011: DECFSZ 20,F
0012: GOTO 011
0013: GOTO 014
0014: DECFSZ 00,F
0015: GOTO 008
0016: MOVLP 00
0017: GOTO 032 (RETURN)
.................... // user define PIN I/O
.................... #define led2 PIN_A2 //test LED
....................
.................... //main program loop
.................... main() {
0018: CLRF 04
0019: MOVLW 1F
001A: ANDWF 03,F
001B: MOVLW 6C
001C: MOVLB 01
001D: MOVWF 19
001E: MOVLB 03
001F: CLRF 0C
0020: MOVLB 02
0021: CLRF 12
0022: CLRF 11
.................... setup_comparator(NC_NC); //no comparators
0023: CLRF 12
0024: CLRF 11
.................... setup_adc_ports(no_analogs); //no analogs
0025: MOVLB 01
0026: BCF 1E.0
0027: BCF 1E.1
0028: MOVLW 00
0029: MOVLB 03
002A: MOVWF 0C
002B: MOVWF 0E
....................
.................... while(TRUE) { //forever loop
.................... delay_ms(500); // 1/2 second delay is really 40us !!!
002C: MOVLW 02
002D: MOVLB 00
002E: MOVWF 25
002F: MOVLW FA
0030: MOVWF 26
0031: GOTO 003
0032: DECFSZ 25,F
0033: GOTO 02F
.................... output_toggle(led2); //test led
0034: MOVLB 01
0035: BCF 0C.2
0036: MOVLW 04
0037: MOVLB 02
0038: XORWF 0C,F
.................... }
0039: MOVLB 03
003A: GOTO 02C
....................
.................... } //end of new main
003B: SLEEP
Configuration Fuses:
Word 1: 37C4 INTRC_IO NOWDT PUT MCLR NOPROTECT NOCPD BROWNOUT CLKOUT IESO FCMEN
Word 2: 1EFF NOWRT PLL_SW STVREN BORV19 NODEBUG NOLVP |
here's the listing..
goto 003 is where the PIC should kill 500ms but insted only 40us !
time to get paper and pencil out..
it'd be interesting to see someone else's listing to see if it's the same... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Sat Mar 02, 2019 7:46 am |
|
|
No, The goto 003, is only one main delay loop.
The code loads a count into register 25, and then loops back to goto 003
again if this is not zero.
Now looking at the code, what leaps out is that your main delay loop
is only using a 8 bit value.
Using my version of the same compiler, it gives:
Code: |
.................... #use delay(clock=4Mhz) //1us per instruction
0003: MOVLW 20
0004: MOVWF 05
0005: MOVLW 06
0006: MOVWF 04 //Note here two values loaded
0007: MOVF 00,W
0008: BTFSC 03.2
0009: GOTO 018
000A: MOVLW 01
000B: MOVWF 21
000C: CLRF 20
000D: DECFSZ 20,F
000E: GOTO 00D
000F: DECFSZ 21,F
0010: GOTO 00C
0011: MOVLW 4A
0012: MOVWF 20
0013: DECFSZ 20,F
0014: GOTO 013
0015: GOTO 016
0016: DECFSZ 00,F
0017: GOTO 00A
0018: MOVLP 00
0019: GOTO 03E (RETURN)
|
Note your code only loads one byte not two.
4.114, was close to the point where the compiler first started
accepting 16bit values for the delay counts. The manual at this point
says:
Quote: |
Note: Previous compiler versions ignored the upper byte of an int16, now the upper byte affects the time.
|
Your code is behaving as if the compiler is not accepting the high
byte.... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Sat Mar 02, 2019 8:44 am |
|
|
Well remembered/found PCM... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9081 Location: Greensville,Ontario
|
|
Posted: Sat Mar 02, 2019 11:07 am |
|
|
Well I'm even more confused (if that's possible), as the same program for a 12F683 compiles and runs and the only difference in the '#use delay(..)' code
is MOVLW 26 for the 683, MOVLW 06 for the 1822. The rest of the 20 lines of code are identical so I assumed that is the problem as I couldn't see why the 'delay' routine would be different for different PICs even though the clocks are the same, and same delay values. Meanwhile I've confirmed my XP machine setup does the same ..even though I swear it was fine the other day...
sigh |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9081 Location: Greensville,Ontario
|
|
Posted: Sun Mar 03, 2019 9:16 am |
|
|
Finally I'm back to where I was a week ago...
Located a newer version (never ever toss out old HDs !) and LED blinks
of course. Last night the PK3 died, bought another 1hr ago (part of the picdem pic18 explorer kit, rest I'll never use)... so I'm up and running.
note : PICkit3 is now 'obsolete'...sigh, now I'm really feeling old.
Jay |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Sun Mar 03, 2019 9:25 am |
|
|
Funny thing is that although PK3 is "obsolete", PK4 shows up with a yellow light in MPLABX, meaning that it's not fully tested.
Nevertheless, I've gotten myself a PK4 and it works with the micro I use so it's fine. The firmware of PK4 is also not fully developed yet. There's a button on there for programmer to go, but it's disabled for now and it'll get added with a future update of MPLAB. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|