Author Topic: PIC16C505, does it automatically lock?  (Read 5039 times)

0 Members and 1 Guest are viewing this topic.

Offline StonentTopic starter

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
PIC16C505, does it automatically lock?
« on: November 09, 2013, 11:12:36 am »
I got my Velleman Pic programmer working and just for the fun of it I pulled the PIC16C505 from my Velleman TV Tennis game and tried to read it. It looked like it finished but then it got an error OSCCAL 3FFF  :--

I'm guessing that's its way of telling me "Scram! The door is dead bolted and you're not coming in!" ?

Since the 16C chips are one time programmable, do they automatically enable code protection?
The larger the government, the smaller the citizen.
 

Offline Crazy Ape

  • Regular Contributor
  • *
  • Posts: 181
Re: PIC16C505, does it automatically lock?
« Reply #1 on: November 09, 2013, 03:49:38 pm »
Automatically enable code protection? Nope.

The code protection is set via the configuration bits just like in a flash based PIC.

Page 37 of the data sheet.
http://ww1.microchip.com/downloads/en/devicedoc/40192c.pdf
 

Offline garak

  • Contributor
  • Posts: 32
  • Country: au
Re: PIC16C505, does it automatically lock?
« Reply #2 on: November 09, 2013, 05:54:37 pm »
From memory, OSCCAL on that PIC is a 14 bit word, and I'd be willing to bet a few slices of pizza that 0x3FFF (i.e. all ones) is an invalid value, something is pulling the data line constantly high. You should check your socket/wiring. Are you using a real serial port for this? If not, then this could also be the cause.
 

Offline StonentTopic starter

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: PIC16C505, does it automatically lock?
« Reply #3 on: November 09, 2013, 09:07:21 pm »
Yep full built on the motherboard serial. None of this USB nonsense.
The larger the government, the smaller the citizen.
 

Offline garak

  • Contributor
  • Posts: 32
  • Country: au
Re: PIC16C505, does it automatically lock?
« Reply #4 on: November 10, 2013, 09:34:33 am »
A quick Google seems to reveal that you're not the first to have trouble with the 16C505 and the Velleman programmer, but I only had a quick look and didn't find any solutions. If you're sure that the programmer is working correctly then you might just be out of luck. You could also try going to velleman's site and getting the latest software. The copy they provide on disk is probably ancient.

I started off with the Velleman programmer too (seems like a long time ago, now) and I found it pretty limiting. If you really want to get into PIC work, you'll be far better off with something like a PICKit 3, which can be had for about $45USD+S/H. Using one of these will allow you to use all the tools etc that MPLAB gives you, including In-Circuit debugging, which will be very handy. I personally use a MikroProg from MikroElektronica which was more expensive, but since I use their compiler anyway it made sense.

Here's a link to the PICKit3 in the US: http://www.microchipdirect.com/ProductSearch.aspx?Keywords=PG164130

Their lead time is pretty awful though. Sparkfun have the same thing for $50 here, but a little hunting might reveal a better price.
 

Offline StonentTopic starter

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: PIC16C505, does it automatically lock?
« Reply #5 on: November 10, 2013, 10:55:18 am »
Yeah I can program the pic that came with it just fine and the demo hex file tests all the buttons and leds on the board works. I bought the velleman kit because it was $6 at RadioShack and have never played with Pics before. Just AVR and MSP430. It has a port on the board that you can plug a pickit into so it is useful as a premade programmer with sockets for 8 pin through 28 pin chips.
The larger the government, the smaller the citizen.
 

Offline garak

  • Contributor
  • Posts: 32
  • Country: au
Re: PIC16C505, does it automatically lock?
« Reply #6 on: November 10, 2013, 11:33:34 am »
Ahh, for $6 that wasn't a bad buy at all. That's probably less than it costs Velleman to actually make the things. Methinks RS are doing some stock clearance.

The other thing you could try would be to go into the software settings and turn the speed down as far as it can go. It'll take a lot longer to read, but it might actually be able to do it.

Of course, the other possibility is that code protection is indeed turned on. I've not done ANY PIC work in about a year, and nothing on PIC16 for twice that, but IIRC you should be able to read the config bits regardless of the state of the code protection. This will tell you if code protect has been turned on.

EDIT: Having let my head tick along a little more, I'm now pretty sure that your device has CP enabled. I think what's happening is that the programmer software is attempting to extract the OSCCAL value from the code so that it can be used again, and since the CP is turned on it gets nothing. It's still worth reading the config bits if you can, because I am rusty and by no means an expert, but I'm pretty sure it's locked down.
« Last Edit: November 10, 2013, 11:41:01 am by garak »
 

Offline JTR

  • Regular Contributor
  • *
  • Posts: 107
  • Country: au
Re: PIC16C505, does it automatically lock?
« Reply #7 on: November 10, 2013, 11:50:07 am »
From memory, OSCCAL on that PIC is a 14 bit word, and I'd be willing to bet a few slices of pizza that 0x3FFF (i.e. all ones) is an invalid value, something is pulling the data line constantly high. You should check your socket/wiring. Are you using a real serial port for this? If not, then this could also be the cause.

Hawaiian, with extra pineapple.  :-+ The PIC16C505 is a BASELINE part. Its OSCCAL is 12-bits.
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8420
Re: PIC16C505, does it automatically lock?
« Reply #8 on: November 10, 2013, 12:46:28 pm »
Try to read the config word first, it is readable even if code protection is enabled (and if it's not readable, then suspect the programmer/connections.)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf