Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Help me convert microBasic code to microC

Status
Not open for further replies.

sahu

Advanced Member level 2
Joined
Oct 9, 2009
Messages
516
Helped
68
Reputation
130
Reaction score
62
Trophy points
1,308
Location
Uttar pradesh (INDIA)
Activity points
3,876
hear one code , which in microBasic.help me for conversion in microC.
 

Attachments

  • ledblinking.txt
    1.4 KB · Views: 60

Re: microBasic vs microC

Code:
/*program led1blinking
		16F676 Configuration
		O = Output, I = Input
					      _________
					Vdd   | 1  14 |  Vss
		(I) SW1 --> RA5   | 2  13 |  AN0 <-- ADC_Value (I)
		(I) SW2 --> RA4   | 3  12 |  RA1 --> RL4 (O)
				   MCLR   | 4  11 |  RA2 --> RL5 (O)
		(O)  L1 <-- RC5   | 5  10 |  RC0 --> RL1 (O)
		(O)  L1 <-- RC4   | 6   9 |  RC1 --> RL2 (O)
		(O) BZR <-- RC3   | 7   8 |  RC2 --> RL3 (O)
						  ---------
*/


#define L1 PORTC.4
#define L2 PORTC.5
#define sw1 PORTA.5


void led1blinking()
{
	int yy as byte
	for(yy=0;yy<10;yy++)
	{

		L1=1
		delay_ms(1)    // change 1 to "1000" for 1 SEC for real card
		L1=0
		delay_ms(1)     // change 1 to "1000" for 1 SEC for real card


	}
}
void led2blinking()
{
	int yy as byte
	for(yy=0;yy<10;yy++)
	{

		L2=1
		delay_ms(1)    // change 1 to "1000" for 1 SEC for real card
		L2=0
		delay_ms(1)     // change 1 to "1000" for 1 SEC for real card


	}
}


void main()
{

CMCON = CMCON or 0x07
ANSEL = 0
trisa.0=1
porta.0=1
trisc=0
portc=0

	while(1)
	{
		for(i=0;i<10;i++)
		{
			led1blinking();

		}
		for(i=0;i<10;i++)
		{
			led2blinking();

		}
	}

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top