Programming PIC12F508/12F675 microcontrollers using Mickro C

Microcontroller Topics
Post Reply
Kriz
Corporal
Corporal
Posts: 6
Joined: Sat Aug 20, 2011 9:49 pm

Programming PIC12F508/12F675 microcontrollers using Mickro C

Post by Kriz » Fri Jul 25, 2014 3:56 pm

Hi Friends,

Does any one program PIC12F508/12F675 micro controllers using Mikro C (product of MikroElektronika) ?.
it's really appreciate if any one can guide me .

thanks. :
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Programming PIC12F508/12F675 microcontrollers using Mickro C

Post by Neo » Tue Jul 29, 2014 1:45 am

I did PICs with HI-TECH C which is very good compiler suite for MPLab. If you can describe your problem, will try to help you.
Kriz
Corporal
Corporal
Posts: 6
Joined: Sat Aug 20, 2011 9:49 pm

Re: Programming PIC12F508/12F675 microcontrollers using Mickro C

Post by Kriz » Tue Jul 29, 2014 5:08 pm

actually I wanted to generate some LED light patterns.if you can explain the logic then i will able to try . then i ask if there are any issues.
thanks a lot.
:D
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Programming PIC12F508/12F675 microcontrollers using Mickro C

Post by Neo » Sat Aug 02, 2014 2:59 pm

This tutorial will help to get you started...
https://robot.lk/viewtopic.php?f=18&t=1587
Kriz
Corporal
Corporal
Posts: 6
Joined: Sat Aug 20, 2011 9:49 pm

Re: Programming PIC12F508/12F675 microcontrollers using Mickro C

Post by Kriz » Thu Aug 07, 2014 2:32 pm

I've managed to do it for the both PIC12F508 ,PIC12F675 micro-controllers .here is the code for "Budu Rasmala" :yahoo:
here it is .hope this will help to others also.and thank you! very much NEO.

Code: Select all

/ * Coded By Kriz
 * Created:   Sun Aug 3 2014
* Processor: PIC12C508A
* Compiler:  HI-TECH C for PIC10/12/16
*/

#include <htc.h>
#define _XTAL_FREQ 4000000
int a= 8;
int b= 8;
int c= 8;
int d= 8;
int e= 8;
int h= 1;

void main(void)
 {
    TRISGPIO = 0;
    while(h)             /*main loop*/
              {
		   while (a>0)      
		                {
                                GPIO=0x01;
                       __delay_ms(250);
                                GPIO=0x02;
                       __delay_ms(250);
		                GPIO=0x10;
                       __delay_ms(250);
                               GPIO=0x20;
                      __delay_ms(250);
			       GPIO=0x00;
                      __delay_ms(100);
	 		           a--;
		                               }
		
		                while (b>0)
		                               {
                               GPIO=0x33;
                      __delay_ms(250);
                               GPIO=0x32;
                      __delay_ms(250);
		              GPIO=0x30;
                     __delay_ms(250);
                              GPIO=0x20;
                      __delay_ms(250);
	                      GPIO=0x00;
                     __delay_ms(100);
			               b--;
		}
		
		              while (c>0)
		                               {
                               GPIO=0x22;
                      __delay_ms(250);
                               GPIO=0x11;
                      __delay_ms(250);
		               GPIO=0x00;
                        __delay_ms(50);
			             c--;
		}
		
		               while (d>0)
		                               {
                                GPIO=0x33;
                       __delay_ms(250);
                                GPIO=0x32;
                       __delay_ms(250);
		               GPIO=0x31;
                       __delay_ms(250);
                               GPIO=0x23;
                      __delay_ms(250);
			       GPIO=0x13;
                      __delay_ms(250);
			       GPIO=0x00;
                        __delay_ms(10);
			d--;
		}
		
		                while (e>0)
		                               {
                               GPIO=0x33;
                      __delay_ms(250);
                               GPIO=0x00;
                      __delay_ms(250);
                                          e--;		
		}
		
		     h++;
		}
    
 }
Post Reply

Return to “Microcontrollers”