Device configuration

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

Re: Device configuration

Postby Dimebag » Sun Jul 20, 2014 11:40 am

Code: Select all
void delay(void) {

//inside-- is slower
//inside++ is faster
    for (inside = 0; inside > scanPin; inside++) {
         for (outside = 0; outside < temp; outside++) {
        // }
   //      for (inside = 0; inside < 5000; inside--) {
    }
}
}
Dimebag
 
Posts: 109
Joined: Sun Jun 29, 2014 7:51 am
Location: Sydney, Australia

Re: Device configuration

Postby ric » Sun Jul 20, 2014 11:51 am

Rolling your own time delays can be tricky.
Please remind me which compiler you are using.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: Device configuration

Postby Dimebag » Sun Jul 20, 2014 11:58 am

ok
Last edited by Dimebag on Sun Jul 20, 2014 12:15 pm, edited 1 time in total.
Dimebag
 
Posts: 109
Joined: Sun Jun 29, 2014 7:51 am
Location: Sydney, Australia

Re: Device configuration

Postby ric » Sun Jul 20, 2014 12:05 pm

XC8 has an accurate time delay function built in. Look in the user guide for
__delay_ms()
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: Device configuration

Postby Dimebag » Sun Jul 20, 2014 12:22 pm

I am looking at devices within PIC24 and PIC32 to use. I just need help with C in the mean while.
Dimebag
 
Posts: 109
Joined: Sun Jun 29, 2014 7:51 am
Location: Sydney, Australia

Re: Device configuration

Postby Dimebag » Sun Jul 20, 2014 12:40 pm

More interested in PIC24 currently. I will start on PIC32. Currently my local electronic store does not have PIC24 :(
Dimebag
 
Posts: 109
Joined: Sun Jun 29, 2014 7:51 am
Location: Sydney, Australia

Re: Device configuration

Postby Dimebag » Sun Jul 20, 2014 12:41 pm

In the meantime 18F452 is selected as target device. Funny they have ATmega/12F-C/16F/18F/18LF
Dimebag
 
Posts: 109
Joined: Sun Jun 29, 2014 7:51 am
Location: Sydney, Australia

Re: Device configuration

Postby Dimebag » Sun Jul 20, 2014 1:12 pm

Thanks ric, I will look at using the function delay_ms().
I am wondering if using "array[]" is the best way for expanding my code, it is working at bare minimum. An array can only have values stored inside the "array[]" to be used after its complied. I am not sure if you can change the 'array[]' values after its complied.
Dimebag
 
Posts: 109
Joined: Sun Jun 29, 2014 7:51 am
Location: Sydney, Australia

Re: Device configuration

Postby ric » Sun Jul 20, 2014 1:28 pm

Yes, you can change array values after compilation, so long as you haven't specifically told the compiler it is a constant.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: Device configuration

Postby Tom Maier » Sun Jul 20, 2014 1:43 pm

Dimebag wrote:In the meantime 18F452 is selected as target device. Funny they have ATmega/12F-C/16F/18F/18LF


Dimebag,

What tools are you using? You shouldn't see ATmega if you are using XC8.

Also do you have a programmer? If so, which one?

You need to get back to just writing a program that blinks an LED. You are getting sidetracked onto other subjects.
User avatar
Tom Maier
Verified identity
 
Posts: 179
Joined: Mon May 26, 2014 2:37 pm
PIC experience: Professional 5+ years with MCHP products

PreviousNext

Return to 16-Bit Core

Who is online

Users browsing this forum: No registered users and 20 guests

cron