Device configuration

(instructions, reset, WDT, specifications...) PIC17Cxx, PIC18Fxxx

Re: Device configuration

Postby Tom Maier » Sat Aug 02, 2014 6:18 pm

Your assignment is to study game theory and try to understand why you think people are your enemy and they pick on you for no reason. Why are people so mean to you? Which game is happening and why?

http://www.ericberne.com/games-people-play/

Only then can you conquer the mysteries of C, grasshopper.
User avatar
Tom Maier
Verified identity
 
Posts: 179
Joined: Mon May 26, 2014 2:37 pm
PIC experience: Professional 5+ years with MCHP products

Re: Device configuration

Postby majid1986 » Thu Dec 25, 2014 8:02 pm

i think 16bit micros are so efficient
http:// www. electrotechnic. mihanblog. com/post/59
Last edited by ric on Thu Dec 25, 2014 10:50 pm, edited 1 time in total.
Reason: spam
majid1986
 
Posts: 1
Joined: Thu Dec 25, 2014 7:58 pm

Re: Device configuration

Postby ric » Thu Dec 25, 2014 10:50 pm

It looks like we have our first spammer.
I've inserted spaces into the URL they posted to stop Google following it.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 454
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: Device configuration

Postby drh » Fri Dec 26, 2014 3:57 pm

Send him/it to the cornfield Ric.
User avatar
drh
Verified identity
 
Posts: 56
Joined: Tue May 27, 2014 3:31 pm
Location: Hemet, Calif.
PIC experience: Professional 5+ years with MCHP products

Re: Device configuration

Postby HUD357 » Fri Aug 07, 2015 9:37 pm

I appreciate that this thread ran out of steam some time ago but it provided such entertaining reading that I just had to reply. Hopefully this reply will help some genuine newcomer.

I'm going to completely ignore the non PIC or 'C' posts and concentrate on the earlier answer ...

(from)Tom Maier
Dimebag,
[...] You need to get back to just writing a program that blinks an LED. You are getting sidetracked onto other subjects.[...]


The reason I have added to this thread is because if one were a genuine 'beginner' (and everyone here was too) with micro controllers and 'C' then you may have missed that statement. .

It has been a tradition from the first days of the 'C' language (and now many others) to provide newcomers with some code in that prints "hello world" to some output device on whatever 'platform' you are looking at (Windows, OSX, LINUX, MS-DOS..).

The blinking LED is the micro controller world version of "hello world".

What does that blinking LED tell you?

i) You have managed, electronically, to feed your chosen device correctly. (hardware is OK)
ii) You have successfully configured the chip internally. In PIC terms, you have correctly configured the Oscillator for example.
iii) You have successfully configured an internal device .. a timer for example and set some port pins correctly (The LED blinks).

Quite a lot of information for a blinking LED when you think about it. It means that you have read and understood a fair portion of the documentation for your chosen device. You have translated that reading into some physical design and converted those ideas into 'code' that forces some glorified sand into telling you the temperature in an engine cylinder. A blinking LED is a lot of the way there.
HUD357
 
Posts: 1
Joined: Fri Aug 07, 2015 6:52 pm
PIC experience: Professional 5+ years with MCHP products

Re: Device configuration

Postby Olin Lathrop » Tue Aug 18, 2015 10:51 pm

HUD357 wrote:It has been a tradition from the first days of the 'C' language (and now many others) to provide newcomers with some code in that prints "hello world" to some output device on whatever 'platform' you are looking at (Windows, OSX, LINUX, MS-DOS..).


The blinking LED (or equivalent) isn't just for newcomers. I've done over 100 PIC projects professionally, and the first code I put on a PIC is usually my boilerplate setup customized for that app, then all the app does is go into a loop toggling a pin. I usually have the preprocessor compute what the pin toggle frequency should be, then check that with the scope to make sure it's right. LEDs are overrated in that you don't always have one connected to a pin on every project, and humans aren't good at judging frequency. The scope doesn't require anything be connected to the pin, and it measures and displays the frequency directly.

When the pin is toggling at the right frequency, you know that:

1 - Code was successfully built and loaded into the PIC.

2 - Enough of the configuration is right to allow the PIC to run as wired up.

3 - The oscillator is apparently set up as intended.

4 - All the boilerplate code customized for this app ran, set up the pin as a output correctly, and at least didn't do something stupid to keep the app from ever running, the processor resetting, etc.

This method once reminded me of a obscure "feature" of the 16 bit E series PICs that I had forgotten about. The bit toggle loop ran too slowly. I knew about jumps taking longer relative to the other 16 bit PICs, but had missed that writes to certain SFRs take two cycles, not a single cycle as on other PICs. The LAT register being toggled was such a register, so the BTG instruction took two cycles instead of the expected one.

It's a lot easier to find and track down such issues with stripped down code than later when the app is doing all kinds of things that could be causing the symptoms.
User avatar
Olin Lathrop
Verified identity
 
Posts: 48
Joined: Fri May 30, 2014 3:38 pm
Location: Littleton, MA USA
PIC experience: Professional 5+ years with MCHP products

Re: Device configuration

Postby RodCarty » Tue Nov 24, 2015 5:26 pm

As per my experience if you are planning something that will require a lot of intense timing requirements then it would be to your advantage to get off that old chip and go to a more advanced version that can run 32 MHz or more.
It will give you a shorter instruction cycle and thus more "ticks" and instructions for you timing routines.
Also if you plan on doing anything math intensive, get off the pic18 alltogether and move to the pic24 line of chips.
RodCarty
 
Posts: 1
Joined: Tue Nov 24, 2015 5:12 pm

Previous

Return to 16-Bit Core

Who is online

Users browsing this forum: No registered users and 9 guests