MODCHIP
Junior Member level 3
- Joined
- Feb 13, 2008
- Messages
- 29
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Activity points
- 1,495
hello evrybody
i m trying to drive a 4 wire hdd motor with pic 16f675 so i try this schematic with the commun pin of the motor connected to 12v
i m asking if it will be working with this code
#include <12F675.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOCPD //No EE protection
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOPUT //No Power Up Timer
#FUSES NOBROWNOUT //No brownout reset
#FUSES BANDGAP_HIGH
#use delay(clock=4000000)
int8 count,delay,a;
#define data1 pin_A0
#define data2 pin_A4
#define data3 pin_A5
#int_RTCC
void RTCC_isr(void)
{
count++;
if (count==a*3){count=0;}
}
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);
// TODO: USER CODE!!
a=10;
do
{
if(count<a){output_high (data1);output_low (data2);output_low (data3);}
if(count>=a&count<a*2){output_low (data1);output_high (data2);output_low (data3);}
if(count>a*2&count<a*3){output_low (data1);output_low (data2);output_high (data3);}
}while (1);
}
i m trying to drive a 4 wire hdd motor with pic 16f675 so i try this schematic with the commun pin of the motor connected to 12v
i m asking if it will be working with this code
#include <12F675.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOCPD //No EE protection
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOPUT //No Power Up Timer
#FUSES NOBROWNOUT //No brownout reset
#FUSES BANDGAP_HIGH
#use delay(clock=4000000)
int8 count,delay,a;
#define data1 pin_A0
#define data2 pin_A4
#define data3 pin_A5
#int_RTCC
void RTCC_isr(void)
{
count++;
if (count==a*3){count=0;}
}
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);
// TODO: USER CODE!!
a=10;
do
{
if(count<a){output_high (data1);output_low (data2);output_low (data3);}
if(count>=a&count<a*2){output_low (data1);output_high (data2);output_low (data3);}
if(count>a*2&count<a*3){output_low (data1);output_low (data2);output_high (data3);}
}while (1);
}