SK40C Beginner

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

SK40C Beginner

Postby vick5821 » Tue Jan 31, 2012 8:09 pm

Hey guys, I have just got my SK40C today!!! Damn excited.However, I do not know how to start ? I downloaded the code from cytron tutorial websites but it build failed in MPLAB IDE..

how to solve it ?

This is the error msg :(

Image
vick5821
Discoverer
 
Posts: 85
Joined: Tue Jun 28, 2011 10:21 pm

Re: SK40C Beginner

Postby robosang » Tue Jan 31, 2012 8:59 pm

Printscreen the whole MPLAB IDE, show us the project window.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: SK40C Beginner

Postby nazfar » Wed Feb 01, 2012 3:01 pm

It is because your compiler does not recognize the library of "system.h" for your MC. Based on my experience, i am using PIC16F877A and using the library as same as you do but after I removed the library, it works ;) and my program working as I expected. I think it is because of your MC do not have such library to call. I hope it helps you ;)
nazfar
Newbie
 
Posts: 11
Joined: Tue Nov 29, 2011 1:31 pm

Re: SK40C Beginner

Postby vick5821 » Wed Feb 01, 2012 3:48 pm

vick5821
Discoverer
 
Posts: 85
Joined: Tue Jun 28, 2011 10:21 pm

Re: SK40C Beginner

Postby vick5821 » Wed Feb 01, 2012 3:49 pm

nazfar WROTE:It is because your compiler does not recognize the library of "system.h" for your MC. Based on my experience, i am using PIC16F877A and using the library as same as you do but after I removed the library, it works ;) and my program working as I expected. I think it is because of your MC do not have such library to call. I hope it helps you ;)

Then what should I do ?
vick5821
Discoverer
 
Posts: 85
Joined: Tue Jun 28, 2011 10:21 pm


Re: SK40C Beginner

Postby robosang » Wed Feb 01, 2012 9:20 pm

Ober, you are right, I have that problem too. Why is HI-TECH changing it? Really not convenience to us. I have to change all my old code accordingly. Worst, they also change some of the register name, such as ADGO become AD_GODONE. :o
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: SK40C Beginner

Postby vick5821 » Wed Feb 01, 2012 10:29 pm

CODE: SELECT_ALL_CODE
#include <pic.h>

__CONFIG ( 0x3F32 );

#define LED_1 RC3
#define LED_2 RC2
#define LED_3 RA0

void init(void);
void delay(unsigned long data);

void main(void)
{
init();


for(int i=0;i<3;i++)
{
LED_1=1;
LED_2=0;
delay(100000);
LED_1=0;
LED_2=1;
delay(100000);
LED_1=0;
LED_2=0;
LED_3=1;
delay(100000);
LED_1=0;
LED_2=1;
LED_3=0;
delay(100000);
}
for(int j=0;j<3;j++)
(
LED_1 =1;
LED_2=1;
LED_3=1;
delay(100000);
}




void init()
{
TRISA=0b00000000;
TRISB=0b00000000;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b00000000;

}

void delay(unsigned long data) //delay function, the delay time
{
for( ;data>0;data-=1); //depend on the given value
}

This is my code, and this is how it operate..Weird working based on code right? anyone can tell me why ?

http://www.youtube.com/watch?v=egRCZTx3 ... e=youtu.be
vick5821
Discoverer
 
Posts: 85
Joined: Tue Jun 28, 2011 10:21 pm

Re: SK40C Beginner

Postby ABSF » Thu Feb 02, 2012 7:05 am

for(int j=0;j<3;j++)
(
LED_1 =1;
LED_2=1;
LED_3=1;
delay(100000);
}


If you are expecting the above code to flash the 3 LED for 3 times, you wont be able to get it. Think about it over carefully. The rest of the video matches your code.

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia


Next

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 0 guests