Thank you to the guys at HEGE supporting Badcaps [ HEGE ] [ HEGE DEX Chart ]
Announcement
Collapse
No announcement yet.
Questions about PicKit 3.
Collapse
X
-
Re: Questions about PicKit 3.
Originally posted by stj View Poststatus led only changes when the programmer software does something.
on the forum there was a couple of interesting things.
1: dont run the IDE and IPE (programming) apps at the same time - they will both try to mess with the pk3 and could clash.
2: win10 may need a reg patch unless your using the latest mplab-x version which is 3.10 or higher.
I'm using the latest version of MPLab X I do believe, 3.15. Downloaded it from MicroChip last night and installed it.
Device Manager shows it's using Microsoft drivers from 2006 (just generic HID drivers). It shows up under device manager as USB Input Device. I had the PC look for newer drivers using the Update Driver tab, no luck though.-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
I believe the PicKit3 is now working. There's only one issue but it's not a big one Stj. If I unplug the PicKit3 from the PC, I have to wait 20 - 25 seconds or so before plugging it back in. If I do not wait this amount of time and plug it in, all three lights stay solidly lit and the device is never recognized as being plugged in. I even went into the registry and changed EnhancedPowerMangementEnabled to 0 as suggested in the comment section to the link you posted.
As for the video, where they talk about disabling driver signature enforcement, am I supposed to be using MicroChip drivers? I've printed out the manual and it shows for the PicKit3, it's just recognized as a HID device under Windows. To me, that means it's supposed to use the Microsoft drivers.-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
Is there a chance when I plugged it in for the first time with the bad USB cable and MPLab X updated the firmware that something might not of gotten updated properly? I mean, I remember something about the output window saying Uploading blah blah blah, Uploading blah blah blah, error connecting to device. I wish I could find away to force it to reupdate it now that we got a good USB cable there.-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
firmware is device specific,
if you change the settings for a different pic chip it will re-upload the firmware to the pk3.
then change it back to the 16f628a or whatever.
the 25seconds thing is probably win10 polling the usb pretty slow because it's a laptop, check the power settings so it's not running in low-power mode.
Comment
-
Re: Questions about PicKit 3.
Originally posted by stj View Postfirmware is device specific,
if you change the settings for a different pic chip it will re-upload the firmware to the pk3.
then change it back to the 16f628a or whatever.
the 25seconds thing is probably win10 polling the usb pretty slow because it's a laptop, check the power settings so it's not running in low-power mode.-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
I hooked up a USB hub and when I plug the PicKit3 into the hub, I don't have the problem. The USB Hub is powered by the USB port and I don't remove the hub. So looks like this is more than likely the polling problem you was talking about Stj. To me though, I think I'm happy with this setup-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
Originally posted by mariushm View PostPIC16F628A is a relatively weak microcontroller, it has very few features, little memory and ram, there's much better chips out there with more built in features like hardware i2c and spi, which could be useful.
My favourite goto for tests is PIC16F1519 : http://www.digikey.com/product-detai...2FP-ND/2651374
It's wide dip so it's easy to put on prototyping board, it's dip40 so it has lots of i/o pins, has 28 KB of flash (16 kwords because each word is 14 bits) so you can just code without worrying about optimizations to reduce program size, built in 16 mhz oscillator so you don't need to use external oscillator to go above 4 Mhz (as it happens with your chosen pic)
It's kinda hard to damage a pic just by programming it with bad code. MPLAB-X is pretty good about spotting mistakes so it would be kinda hard to create a broken binary and have mplab program it to a pic and damage the pic.-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
See page 33 of datasheet: https://cdn.badcaps-static.com/pdfs/...bb83564137.pdf
Your mcu has 2 ports, PORTA and PORTB .
You need to set the direction with TRISA and TRISB (to either input or output) and you may need to disable the comparator like it says in the datasheet using CMCON or CMCONbits (check out the pic16f628.h file in the xc8 include folder)
If some pins on the A port share functionality with other features, you may need to disable those features for the pins to become digital input only.
Basically, start any project by configuring the defining _XTAL_FREQ with the frequency you're going to use, if you plan on using built in delay functions, then configure the internal oscillator bits, disable the internal watchdog timer (it's not a good idea during development) then set the ports to their proper directions and enable or disable the features i want.
You basically have a built-in wizard which should help you set the parameters like you want and then just insert the code in your project... check Window menu > PIC Memory views > Configuration bits , set everything and then hit the generate source code to output
Comment
-
Re: Questions about PicKit 3.
Same here. PICs have very limited resources which are gobbled up quickly by the C compiler. Also they have a fairly simple assembler language - no reason not to learn some of that.Originally posted by PeteS in CARemember that by the time consequences of a short-sighted decision are experienced, the idiot who made the bad decision may have already been promoted or moved on to a better job at another company.
Comment
-
Re: Questions about PicKit 3.
On the contrary. No need to waste time with learning assembly especially with an architecture like the PIC one with its quirks that make it more difficult/different compared to other architectures.
The free xc compiler produces quite decent code, the pro version (for which you can find patch/keygen if you look hard enough) enables some optimizations which reduce the binary size by about 10%, at best 20% - it used to be more in the past.
The performance increase is also minimal between the generated c code and hand assembly, I'd say it really depends on what you do. You can always just do inline assembly in your C project if something is really critical.
Besides all this, there's so many pic versions with so many options regarding ram size and flash size (storage) that unless you sell something in thousands of units, it's cheaper to just go for the next pic mcu in the series, for something like $0.1-0.2 more.
Comment
-
Re: Questions about PicKit 3.
Originally posted by mariushm View PostSee page 33 of datasheet: https://cdn.badcaps-static.com/pdfs/...bb83564137.pdf
Your mcu has 2 ports, PORTA and PORTB .
You need to set the direction with TRISA and TRISB (to either input or output) and you may need to disable the comparator like it says in the datasheet using CMCON or CMCONbits (check out the pic16f628.h file in the xc8 include folder)
If some pins on the A port share functionality with other features, you may need to disable those features for the pins to become digital input only.
Basically, start any project by configuring the defining _XTAL_FREQ with the frequency you're going to use, if you plan on using built in delay functions, then configure the internal oscillator bits, disable the internal watchdog timer (it's not a good idea during development) then set the ports to their proper directions and enable or disable the features i want.
You basically have a built-in wizard which should help you set the parameters like you want and then just insert the code in your project... check Window menu > PIC Memory views > Configuration bits , set everything and then hit the generate source code to output
I'm still a bit confused as to what the comparators are, but from what I've read, if I just want the PORTA pins as digital I/O, I need to disable the comparators. I saw on some PICs, there's this ANSEL / ANSELH function you use to set the ports as digital or analog. Thanks for the help!-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
Originally posted by mariushm View PostOn the contrary. No need to waste time with learning assembly especially with an architecture like the PIC one with its quirks that make it more difficult/different compared to other architectures.
The free xc compiler produces quite decent code, the pro version (for which you can find patch/keygen if you look hard enough) enables some optimizations which reduce the binary size by about 10%, at best 20% - it used to be more in the past.
The performance increase is also minimal between the generated c code and hand assembly, I'd say it really depends on what you do. You can always just do inline assembly in your C project if something is really critical.
Besides all this, there's so many pic versions with so many options regarding ram size and flash size (storage) that unless you sell something in thousands of units, it's cheaper to just go for the next pic mcu in the series, for something like $0.1-0.2 more.-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
Originally posted by stj View Postcomparators are for working with analog inputs.-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
I just want to make sure I got this right. I have PORTA's RA5, RA6 and RA7 set to I/O by setting the configuration bits, so they should be taken care of. For RA0, RA1 and RA3, I just need to disable the comparator and it'll switch them to digital I/O. For RA2, I see the function can be RA2, AN2 or VREF. If I disable the comparator, that leaves RA2 or VREF.
According to the datasheet, I can manipulate VRCON (The Voltage Reference Control Register, Page 67 of the datasheet). To do this, I'd set VRCON to 0b00000000. The only bits that really matter there are bits 6 and 7, right?
Code:[FONT="Times New Roman"] bit 7 VREN: VREF Enable bit 1 = VREF circuit powered on 0 = VREF circuit powered down, no IDD drain bit 6 VROE: VREF Output Enable bit 1 = VREF is output on RA2 pin 0 = VREF is disconnected from RA2 pin bit 5 VRR: VREF Range Selection bit 1 = Low range 0 = High range bit 4 Unimplemented: Read as ‘0’ bit 3-0 VR<3:0>: VREF Value Selection bits 0 ≤ VR <3:0> ≤ 15 When VRR = 1: VREF = (VR<3:0>/ 24) * VDD When VRR = 0: VREF = 1/4 * VDD + (VR<3:0>/ 32) * VDD [/FONT]
Code:[font="Times New Roman"] 4.2.2.2 OPTION Register The Option register is a readable and writable register, which contains various control bits to configure the TMR0/WDT prescaler, the external RB0/INT interrupt, TMR0 and the weak pull-ups on PORTB. Note: To achieve a 1:1 prescaler assignment for TMR0, assign the prescaler to the WDT (PSA = 1). See [B]Section 6.3.1 “Switching Prescaler Assignment”.[/B] [B]REGISTER 4-2: OPTION_REG – OPTION REGISTER (ADDRESS: 81h, 181h)[/B] bit 7 RBPU: PORTB Pull-up Enable bit 1 = PORTB pull-ups are disabled 0 = PORTB pull-ups are enabled by individual port latch values bit 6 INTEDG: Interrupt Edge Select bit 1 = Interrupt on rising edge of RB0/INT pin 0 = Interrupt on falling edge of RB0/INT pin bit 5 T0CS: TMR0 Clock Source Select bit 1 = Transition on RA4/T0CKI/CMP2 pin 0 = Internal instruction cycle clock (CLKOUT) bit 4 T0SE: TMR0 Source Edge Select bit 1 = Increment on high-to-low transition on RA4/T0CKI/CMP2 pin 0 = Increment on low-to-high transition on RA4/T0CKI/CMP2 pin bit 3 PSA: Prescaler Assignment bit 1 = Prescaler is assigned to the WDT 0 = Prescaler is assigned to the Timer0 module bit 2-0 PS<2:0>: Prescaler Rate Select bits [/font]
Last edited by Spork Schivago; 12-09-2015, 11:46 AM.-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
-
Re: Questions about PicKit 3.
I did that with the configuration bits I believe. I set WDTE (Watchdog Timer Enable Bit) to OFF. I think I found how to set the individual bits. Hadn't read through the header file at the time I wrote the question there. From the header, I see stuff like:
Code:// Register: INTCON extern volatile unsigned char INTCON @ 0x00B; #ifndef _LIB_BUILD asm("INTCON equ 0Bh"); #endif // bitfield definitions typedef union { struct { unsigned RBIF :1; unsigned INTF :1; unsigned T0IF :1; unsigned RBIE :1; unsigned INTE :1; unsigned T0IE :1; unsigned PEIE :1; unsigned GIE :1; }; struct { unsigned :2; unsigned TMR0IF :1; unsigned :2; unsigned TMR0IE :1; }; } INTCONbits_t; extern volatile INTCONbits_t INTCONbits @ 0x00B;
Code:INTCONbits.GIE = 1;
-- Law of Expanding Memory: Applications Will Also Expand Until RAM Is Full
Comment
Comment