Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:54 11 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PIC16F454/55 PGC and PGD pins

Author Message
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 600
Posted: 11:25am 25 Apr 2018
Copy link to clipboard 
Print this post


On my Quadrelay controller I just found out that I cant do a pull down to zero
volts through the 100k protection resistor. So I moded one where I cut the 1454
pins and the mites pins work as they should. The pins come from flow switches
open no flow, closed flow. The input goes to a 470ohm then to the 10K pu and 100k
to mite pin. That part of the design was done before the 1454 came into being
as the best way to do console and programing.

PIC16F454/55 USB to serial /programmer
I noticed that on some designs they go directly to the mites PGC and PGD
but others there is a 1k resistor between them. Can the 1454 code set them
as input when not in use ?

I hope so, as it will be easyer to reprogram the 1454's than to add the 1k's.

One other though can an esc sequence of such be added to the 1454 code to
have it send an ID that was set in the code to program it? Could be the last
eight bytes at the end of the code.

That way we could know what mite showed up on which port and work as needed.

Thanks
Quazee


 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:59am 25 Apr 2018
Copy link to clipboard 
Print this post

In my version and i think Matherps too the pins are set to input when in USB/Serial mode.

I tried to have a unique ID in the 1455 but that is not easy (takes time and administration) when you do it at the moment you program the chip.
My idea was to add a menu that is activated by a break signal and then have the opportunity to enter an uniqueID.

I also have a bootloader on it, so then updates would be easier as you can just use the USB for an update.
I am currently busy so that will take some time before it is done.


Microblocks. Build with logic.
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 600
Posted: 09:20am 27 Apr 2018
Copy link to clipboard 
Print this post


After isolating pins 2 and 3 from the the PIC16F454/55 USB to serial /programmer
I measured them and I get a solid 3.3 volts. The MicroBridge is the same way.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 12:06pm 27 Apr 2018
Copy link to clipboard 
Print this post

Herer is a snippet of the coe:
[code]
//Activate/Deactivate PROGRAMMER Mode.
//This is under control of 'Main ProcessIO'
BOOL AI_RaiseEvent(AI_EVENT e) {
switch(e) {
case AI_ACTIVATE:
AI_Activate(); //Setup all the Programmer Pins
AI_State = AI_ACTIVE; break;
case AI_DEACTIVATE:
AI_DeActivate(); //Set all pins into high impedance input mode
AI_State = AI_IDLE; break;
}
return AI_State == AI_ACTIVE;
}

void AI_Activate() {
//Setup variables and PINS
TimerTicks = 0;
LastDelay = 0;
PGC_LOW;PGC_OUTPUT;
PGD_LOW;PGD_OUTPUT;
MCLR_LOW;MCLR_OUTPUT;
}

void AI_DeActivate() {
//put all pins in high impedance mode
PGC_INACTIVE;
PGD_INACTIVE;
MCLR_INACTIVE;
//POWER_OFF
}
[/code]

This is the header file with the macros:
[code]

//Define pins that are used for programming
#define PGC_INACTIVE TRISAbits.TRISA4 = INPUT_PIN
#define PGC_OUTPUT TRISAbits.TRISA4 = OUTPUT_PIN
#define PGC_LOW LATAbits.LATA4 = 0
#define PGC_HIGH LATAbits.LATA4 = 1
#define PGC_PULSE PGC_HIGH;PGC_LOW

#define PGD_INACTIVE TRISAbits.TRISA5 = INPUT_PIN
#define PGD_OUTPUT TRISAbits.TRISA5 = OUTPUT_PIN
#define PGD_INPUT TRISAbits.TRISA5 = INPUT_PIN
#define PGD_LOW LATAbits.LATA5 = 0
#define PGD_HIGH LATAbits.LATA5 = 1
#define PGD_READ PORTAbits.RA5

#define MCLR_INACTIVE TRISCbits.TRISC3 = INPUT_PIN
#define MCLR_INPUT TRISCbits.TRISC3 = INPUT_PIN
#define MCLR_OUTPUT TRISCbits.TRISC3 = OUTPUT_PIN
[/code]

If you are familiar with C then you can see that when the programmer mode is finished it sets pins A4, A5, and C3 to inputs.

Setting a pin to input makes that pin high impedance.
All pull up resistors are disables except for port A3 which is connected to the mode switch.
[code]
//Set all PROGRAMMER pins to input to not disturb other functions
ANSELA = 0x00; //All analog off
ANSELC = 0x00;
#if defined(_PIC16F1459_H_)
TRISB = 0xFF;
#endif
TRISA = 0xFF; //All pins input
TRISC = 0xFF;

OPTION_REGbits.nWPUEN = 0; //Disbale all internal pull ups
WPUAbits.WPUA3 = 1; //Mode switch internal pull up
[/code]
Edited by MicroBlocks 2018-04-28
Microblocks. Build with logic.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2463
Posted: 12:53pm 27 Apr 2018
Copy link to clipboard 
Print this post

connected to the mite using teraterm via the 1455 do the following:

1. press the 'select' button to enter programming mode
2. press the "!" key on your PC's keyboard
3. press the "?" key on your PC's keyboard

you should see something like this:
>
>
>
> V1.18
ascii ICSP v1N


4. press the "4" key to return the 1455 to serial passthrough mode.

report back what you see.


cheers,
rob :-)Edited by robert.rozee 2018-04-28
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 600
Posted: 12:16am 28 Apr 2018
Copy link to clipboard 
Print this post


rob Thanks for the info. Not sure how this is but the 4 mite and 2 bridges
all show v1.17. I did program the 1454's on my mites using MicroBridgePro.bas.

Just redid 2 chips with it and they show the v1.17 ?

Here is the file I used.

2018-04-28_101422_MicroBridgeProg.bas.zip

Thanks
Quazee
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2463
Posted: 08:18am 28 Apr 2018
Copy link to clipboard 
Print this post

from main.c in peter's code:

  Quote   * Version 1.17, 12/09/2016
* LED flashes with serial I/O
* Version 1.18, 02/02/2017
* Improve tidy up on break. Remove weak pullups unless in programming mode


as i recall, the 1.17 version could leave weak pullups enabled on the 1455 pins attached to PGC and PGD on the micromite. for most applications this generally had little impact.

upload the .bas file in the attached zip file to your micromite, then type UPDATE and follow the prompts. this should allow the micromite to update the 1455's application to 1.18. report back if this does or does not clear up the issue.

2018-04-28_181224_1455_v1.18_inc_ds30.zip


cheers,
rob :-)Edited by robert.rozee 2018-04-29
 
Quazee137

Guru

Joined: 07/08/2016
Location: United States
Posts: 600
Posted: 09:47am 28 Apr 2018
Copy link to clipboard 
Print this post


Thanks rob I grabbed the updater and have been updating most the
night.

The MicroBridgePro.bas I used and says it is 1.18. It is the current
file on Geoffg's site. But when using the ! test show as 1.17 not 1.18.

I used the MicroBridge to program a mite. And it to program the blank chips.

Does the file at Geoffg's site need to be updated?

Thanks for the help here. All 25 mites and few v2 Backpacks are happily
working as should now.

Quazee
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025