16F877 ADC reading annomaly

Dec 11, 2007 31 Replies

I've actually just found (removed paper label instead of relying on documentation) that its an 18F458, which returns 10 bit values (unless I set it to 8 earlier in the code?). I've managed to hook up the hardware now, all I need to do is back up the existing code and write the new code in the morning.

Ta so far!

"Coyoteboy" wrote in news: snipped-for-privacy@bt.com:

I use CCS, and I believe the default is 8-bits, unless you set it to 10.

Scott Reverse name to reply

I've struck a snag, I've hooked up the PIC and read the code off it to back it up (using winpic and a basic ICSP programmer) but when I verify it, it fails. Every time I read the code and try to dump to hex file it appears different :-( I dont want to attempt to change the code until I know it will be re-programmable with the original code. Any ideas?

"Coyoteboy" wrote in news:cp6dnVNWX snipped-for-privacy@bt.com:

None. I've never tried reading code of of a microcontroller.

Scott Reverse name to reply

Scott Seidman wrote in news:Xns9A1A6AE231D8Escottseidmanmindspri@130.133.1.4:

Can you just swap out the chip and leave the original alone?? Is it in a carrier?

Scott Reverse name to reply

I can, when I can find one, and I think that will be the next step. Things always work out more complex than you expect dont they.

"Coyoteboy" wrote in news: snipped-for-privacy@bt.com:

Complex enough that one should take a step back and ask if its worth starting from scratch.

Scott Reverse name to reply

Unfortunately I dont have that option, I was seriously tempted to do so at first but it /looked/ like a simple code change and a quick ICSP download to get it working. I'm working on a budget for a project that was already in the mud, im now being driven nuts by it!

Just asa follow-up:

I've rebuilt the code from an old (out of date) copy of the code and fixed the bugs to make it replicate the code on the chip. I've then programmed it to a new IC, including a 50us delay after each channel shift - they're reading perfectly now! I also borrowed an ICD2 programmer which gave me the same read problems as before with my el-cheapo programmer, turns out the original author had indeed write-protected his code.

Cheers for everyones help, particularly Scott and starfire.

"Coyoteboy" wrote in news:c--dnZRFPOJkOB snipped-for-privacy@bt.com:

Good Job!

Scott Reverse name to reply

That's the way to dog it! Perseverance pays off!

Way to go...

Cheers :) Couldn't have done it without you lot! I quite enjoyed it actually!

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required