Jump to content

Attention: RC-CAM.com will be closing down August 2021.

The RC-Cam.com forum was the very first online community dedicated to the advancement of wireless video cameras on radio controlled (R/C) models. This is now called "FPV" (First Person View). We are proud of the contributions that our members have made to the FPV hobby.

We've seen significant changes over the last twenty years. Initially there were a lot of eager R/C hobbyist that built their own video systems. Allowing these creative individuals to share their work was the purpose of this site. Now the FPV market is flooded with low cost systems; Sadly DiY FPV video projects are now rarely discussed.

RC-CAM.com (main site and forum) will be closing down August 2021. This is being announced now (March 2021) so that everyone has time to download any information that is important to them. After the site is shutdown the information will no longer be available here.

We appreciate every member's involvement with advancing the FPV hobby. It is indeed sad to say goodbye to all our online friends. Be safe and stay healthy.



Recommended Posts

Im just about to start programming the 16f818 for the first time. Dose anyone have any code I can use to help me get started ? Something simple using the ADC would be perfect.

I hate starting from scratch, its so easy to get something tiny wrong and then nothing works......

Thanks, Terry

Link to post
Share on other sites

Are you sure ? Unlike the 12f508 that I have been using there in no value in the last flash address.

I have set the OSCCON to 01100000 but I may have the config wrong as I have it as INTRC_IO, what do you think ?

Thanks, Terry

Link to post
Share on other sites

As set you should have a 4MHz clock running your PIC. That's true, it seems they've dropped the OSCCAL on the newer devices. Not that bad actually, saves from losing it :P

Are you sure your PIC isn't running?

Link to post
Share on other sites

From what I see the FOSC<2:0> bits in the config word should be '100' (internal RC, no clock output).

But there's one thing I don't get, when you mention "change the code", do you mean by reprogramming the PIC or in the running software? Oscillator selection can only be done by reprogramming the config word with the programmer :unsure:

Link to post
Share on other sites

Well, if the OSCCON is correct I'll give up... If you're programming in assembly, are you sure you've set the correct register page before setting its value? It's a pretty common mistake... and the default setting will set the RC oscillator at the slowest setting, maybe making your program appear stuck while it's infact running but very slowly...

Link to post
Share on other sites

Mmh, nothing obvious to me... I'd maybe try skipping the oscillator stable wait...

Do you have another chip handy? Might be a defect too... I've once had one that wouldn't set one of the pins high unless I would do 2 consecutive writes :blink:

Link to post
Share on other sites

Hmmm, I dont know, although its even odder than that because it would run in INTRC mode with a resonator connected.

Anyway I need to sort out the propper program now and what I thought was a simple job has turned out to be a very big flow chart so its not so simple after all.

Terry

Link to post
Share on other sites

Something odd going on !

Im just trying to get to grips with the 10bit ADC. I find both ADRESL and ADRESH are always the same, the only way to change between the high and low bits is to change from page0 to page1. Any ideas ?

Terry

Link to post
Share on other sites

Yes I can understand that, thats why I tryed changing the page in the first place. The thing that I dont understand is why it makes no difference if I use ADRESL or ADRESH. It would also of helpped if the data sheet had made this point clear.

Terry

Link to post
Share on other sites
... thats why I tryed changing the page in the first place.

To the PIC, the two registers are at the exact same address/offset. The paging bits determine which is used.

FWIW, this is a common source of PIC programming confusion. The paging issue affects program code space, ram, and registers. Once you've been bitten by it, it will probably never byte you again. :)

The thing that I dont understand is why it makes no difference if I use ADRESL or ADRESH.

Some higher level languages will manage the paging for you. With assy, it is up to the programmer to mess with these little details.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...