From: Michael Lange on
Hi,

AFAIK on some PICs the PGM pin should be connected to gnd (by a
resistor), even in high voltage programming mode. For the 16F628A this
is RB4.

HTH
Michael
From: Thad Smith on
Steve at fivetrees wrote:
> "manfer1984" <manolofblanco(a)hotmail.com> wrote in message
> news:W96dnThs59d5OdzbnZ2dnUVZ_uKknZ2d(a)giganews.com...
>
>>I have some troubles with programing the 16f628A with mplab icd2
>>
>>i configured all bits configured, i don't have any pull up resistor in RB6
>>and RB7, the voltage suply is ok for Vdd and Vpp. the dispositive pass
>>all
>>the self test and the voltage have a rigth value. also i configured de
>>bits configured in the program like this:
>>
>>__CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _MCLRE_OFF &
>>_CP_OFF & _LVP_OFF & _DATA_CP_OFF
>
> I don't know your device at all, but this looks odd to me - it's a series of
> bit masks ANDed with one another. If you're configuring a bit field,
> shouldn't you be ORing them together? (I guess it could be inverse logic...)

Yes, it assumes inverse logic. Start off with all ones and remove
selected bits. I don't know why Microchip selected that technique.

--
Thad
From: Michael Lange on
Thad Smith schrieb:
> Steve at fivetrees wrote:
>> "manfer1984" <manolofblanco(a)hotmail.com> wrote in message
>> news:W96dnThs59d5OdzbnZ2dnUVZ_uKknZ2d(a)giganews.com...
>>
>>> I have some troubles with programing the 16f628A with mplab icd2
>>>
>>> i configured all bits configured, i don't have any pull up resistor
>>> in RB6
>>> and RB7, the voltage suply is ok for Vdd and Vpp. the dispositive
>>> pass all
>>> the self test and the voltage have a rigth value. also i configured de
>>> bits configured in the program like this:
>>>
>>> __CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _MCLRE_OFF &
>>> _CP_OFF & _LVP_OFF & _DATA_CP_OFF
>>
>> I don't know your device at all, but this looks odd to me - it's a
>> series of bit masks ANDed with one another. If you're configuring a
>> bit field, shouldn't you be ORing them together? (I guess it could be
>> inverse logic...)
>
> Yes, it assumes inverse logic. Start off with all ones and remove
> selected bits. I don't know why Microchip selected that technique.

.... to set not listed and unused bits high for default behavior?

Michael
From: Paul E. Schoen on

"Michael Lange" <leckmich(a)despammed.com> wrote in message
news:f2ahss$3f6$01$1(a)news.t-online.com...
> Thad Smith schrieb:
>> Steve at fivetrees wrote:
>>> "manfer1984" <manolofblanco(a)hotmail.com> wrote in message
>>> news:W96dnThs59d5OdzbnZ2dnUVZ_uKknZ2d(a)giganews.com...
>>>
>>>> I have some troubles with programing the 16f628A with mplab icd2
>>>>
>>>> i configured all bits configured, i don't have any pull up resistor in
>>>> RB6
>>>> and RB7, the voltage suply is ok for Vdd and Vpp. the dispositive
>>>> pass all
>>>> the self test and the voltage have a rigth value. also i configured
>>>> de
>>>> bits configured in the program like this:
>>>>
>>>> __CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _MCLRE_OFF &
>>>> _CP_OFF & _LVP_OFF & _DATA_CP_OFF
>>>
>>> I don't know your device at all, but this looks odd to me - it's a
>>> series of bit masks ANDed with one another. If you're configuring a bit
>>> field, shouldn't you be ORing them together? (I guess it could be
>>> inverse logic...)
>>
>> Yes, it assumes inverse logic. Start off with all ones and remove
>> selected bits. I don't know why Microchip selected that technique.
>
> ... to set not listed and unused bits high for default behavior?
>
> Michael

EPROMs have (AFAIK) always been this way, where FFs mean it is blank. The
first PICs were EPROM based, and followed this convention. Flash memory is
also erased as logic 1 and programmed to logic 0.

The OpCodes for the Z80 and some other processors designated 00 as a NOP,
so it was possible to reuse an EPROM by writing zeroes over a previous
program and writing a new program in higher memory. Microchip PICs also
follow this convention for OpCodes, which means you might be able to
reprogram an OTP device.

Paul


From: Michael Lange on
Paul E. Schoen schrieb:
> "Michael Lange" <leckmich(a)despammed.com> wrote in message
> news:f2ahss$3f6$01$1(a)news.t-online.com...
>> Thad Smith schrieb:
>>> Steve at fivetrees wrote:
>>>> "manfer1984" <manolofblanco(a)hotmail.com> wrote in message
>>>> news:W96dnThs59d5OdzbnZ2dnUVZ_uKknZ2d(a)giganews.com...
>>>>
>>>>> I have some troubles with programing the 16f628A with mplab icd2
>>>>>
>>>>> i configured all bits configured, i don't have any pull up resistor in
>>>>> RB6
>>>>> and RB7, the voltage suply is ok for Vdd and Vpp. the dispositive
>>>>> pass all
>>>>> the self test and the voltage have a rigth value. also i configured
>>>>> de
>>>>> bits configured in the program like this:
>>>>>
>>>>> __CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _MCLRE_OFF &
>>>>> _CP_OFF & _LVP_OFF & _DATA_CP_OFF
>>>> I don't know your device at all, but this looks odd to me - it's a
>>>> series of bit masks ANDed with one another. If you're configuring a bit
>>>> field, shouldn't you be ORing them together? (I guess it could be
>>>> inverse logic...)
>>> Yes, it assumes inverse logic. Start off with all ones and remove
>>> selected bits. I don't know why Microchip selected that technique.
>> ... to set not listed and unused bits high for default behavior?
>>
>> Michael
>
> EPROMs have (AFAIK) always been this way, where FFs mean it is blank. The
> first PICs were EPROM based, and followed this convention. Flash memory is
> also erased as logic 1 and programmed to logic 0.
>
> The OpCodes for the Z80 and some other processors designated 00 as a NOP,
> so it was possible to reuse an EPROM by writing zeroes over a previous
> program and writing a new program in higher memory. Microchip PICs also
> follow this convention for OpCodes, which means you might be able to
> reprogram an OTP device.
>
> Paul

thanks for illustrating my answer with some examples.

Michael