domv
New Member
Posts: 5
|
Post by domv on Nov 13, 2010 11:18:43 GMT
Hi Paul I have implemented the function decoder for coach lighting (see attached, the project and schematics based on DipTrace free edition PCB layout from NOVARM and realisation in JOUEF old French CAPITOLE coach). It is working know but I had some troubles during programming with PICKIT3. I used the target power supply and when I tried to program the µC, I had a warning saying that PICKIT3 is not able to programm the µC when INTOSC and MCLR_OFF are set. So I changed the config to _MCLRE_ON and this time the programming went OK. I thus had to modify the GP3 polarisation to pull up to Vdd. Any idea of what going on ? May be should I have selected power from the PICKIT3 to get correct programming from the original schematic instead of from the target.... After that the function decoder was working OK!!! Other topic: I tried to map F0 forward and reverse to output A to have the coach tail light ON for both directions, but it doesnot work. Only F0 reverse is mapped to A. Have you any explanations ? Regards Attachments:
|
|
|
Post by Paul Harman on Nov 13, 2010 15:50:29 GMT
Domv
Lots of questions
1. There is an issue when mapping one output to two functions, it cannot be done. If you want a function to be non directional you will have to use one of the 28 non-directional functions - not the only one that is directional!
2. The problem with using the target power supply is that the target supply cannot be taken down to effect a reset, therefore the programmer needs to be able to assert the MCLR function on the MCLR pin!
Your workaround is OK for the current DIY firmware, but is not compatible with the enhanced firmware or with older revisions which use the MCLR pin for signalling which pin to use for the DCC input.
I would recommand using the programmer power supply when doing in-circuit programming, it should be able to supply power to the decoder 5V supply OK and as long as R13 and D1 are present (R13 must not be a dead short, and D1 prevents reverse current through the regulator). R13 can be a dead short only when the PIC is socketed and removed to an external programmer for programming.
|
|
domv
New Member
Posts: 5
|
Post by domv on Nov 13, 2010 17:35:34 GMT
1) I intended to control the coach light in consist mode with the loco on F0 whatever the direction. The workaround solution is to use 2 outputs mapped on F0 fw & F0 rv with diode OR
2)I saw in the 2.18 SW release that GP3 was not used. This is why I used this solution. In my circuit, there is a big tank capacitor, and if I add D1, the µC supply rise time when supplied by the PICKIT3 may not be compliant for reset. I will try when I build the next PCB for my 2nd CAPITOLE coach and check if OK.
Last question Is there diming capability on outputs A/B/D for the 3 output decoder. It seems NO from the documentation and CV map but if yes, what is the frequency.
Thanks
|
|
|
Post by Paul Harman on Nov 13, 2010 17:58:51 GMT
1. I think you have the best workaround.
2. It is also possible to put a diode in series with the input of the regulator to prevent charging of the capacitor during programming which may help you as an alternative.
3. There is no dimming on outputs in the standard firmware, but flicker is available on the PORTC outputs of the 14-pin PICs (pins 5-10).
|
|
domv
New Member
Posts: 5
|
Post by domv on Nov 19, 2010 22:08:33 GMT
Hello
I tried to programm my second function decoder with the original code (MCLR OFF) with PICKIT3 internal supply but I had a warning message: "PICKIT3 does not support programming this device if both the internal oscillator and internal MCLR are selected" I am using the last version of MPLAB (8.60) .... So I did'nt try to programm the device ....(may be there is an issue with PICKIT3 not supporting Vpp before Vdd sequence for 12f629 programming entry mode).
Thus I will use my original workaround and use MCLR_ON in the code because with this configuration I have no warning message.
regards
|
|
|
Post by Paul Harman on Nov 20, 2010 15:03:47 GMT
It is a pity that I do not have a PICkit3 here to play with - I use a PICkit2. The only other thing that I can think of, is the PICkit3 selected as a programmer or as a debugger in MPlab? The debugger mode requires a lot more communications capability than the programmer mode and I suspect LVP mode may require more specific configuration as well.
|
|
domv
New Member
Posts: 5
|
Post by domv on Nov 24, 2010 22:07:57 GMT
Hi, No I was not using the debugger mode but the programmer mode. I didn't try thr LVP mode. Do you mean that 12f629 is LVP capable ? I didn't saw that in the datasheet. Finally, I had no problem to program with the internal PICKIT power supply even with the 2200µF capacitor on the supply but with MCLR_ON option. I will post questions on MICROCHIP Forum for this 12f629 programming issue
Now, my second function decoder is working OK and I have 2 coaches equiped with nice lighting DCC controlled. I just have to program them in consist mode with the loco for completness
Many thanks, Paul, for this lowcost decoder
Next project is ROCO CORAIL VTU coaches lighting with your decoder.
|
|
|
Post by Paul Harman on Nov 26, 2010 10:41:59 GMT
Excellent that you are up and running.
I treat the ICSP programming method the same as programing in the socket, so I guess that programming in the programmer socket might have the same issue with the PICkit3. Please let me know if you get any feedback from the Microchip forum.
|
|