void main(){
	initPIC();

	while(1) {
		TRISB=0x1F;	
		PORTA=0;
		if((RB4==1) && (PORTB==0x1E)) {
		PORTB=0;
		TRISB=0X00;
		PORTA=0X01;
		stepper(value);

		}	
			
		else if(RB4) {
			value=keypad[PORTB&0x0F];
			delay(15);
			PORTB=value;
			PORTA=0X03;
			TRISB=0X00;
			PORTA=0X01;
		}
		

	}


}
Beispiel #2
0
void main()	{
	
	initPIC();
	initADC();
	PR2 = 0b11111001 ;
	T2CON = 0b00000101 ;
	CCP1CON = 0b00001100 ;
	PORTD = 0;
 	while(1){
	//	ADCON0 = 0x45; // Fosc/8, GO/DONE=1 and ADON=1 
	//	ADCON =  0b01000101
		ADCON0 = 0b01001101;
	 	if(adcflag){		
			convert(result);
			delay(15);
			adcflag=0;
			}
		}					
	
}
Beispiel #3
0
void main()
{
	
	initPIC();
	initADC();
	PR2 = 0b11111001 ;
	T2CON = 0b00000101 ;
	CCP1CON = 0b00111100 ;
 	//=	PR2 = 0b01111100 ;
 	//  T2CON = 0b00000101 ;
	//CCP1CON = 0b00111100 ;	
	//CCPR1L=0;
	while(1){
		ADCON0 = 0x45; // Fosc/8, GO/DONE=1 and ADON=1 
	 	if(adcflag){		
				convert(result);
				delay(20);
				adcflag=0;
			}
		}					
	
}
Beispiel #4
0
void PICComponent::dataChanged()
{
    qDebug() << Q_FUNC_INFO;
	initPIC(false);
}