#byte PORTB = 6
#define ALL_OUT 0
#define ALL_IN 0xff
main() {
int i;
set_tris_b(ALL_OUT);
PORTB = 0; // Set all pins low
for(i=0;i<=127;++i) // Quickly count from 0 to 127
PORTB=i; // on the I/O port pin
set_tris_b(ALL_IN);
i = PORTB; // i now contains the portb value.
} PORTB=Motor; // on the I/O port pin#include "C:\Documents and Settings\Fox\Mis documentos\PIC\Motor paso a paso.h"
void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
# Byte PORTB = 6
# Define ALL_OUT 0
# Define ALL_IN 0xff
#define A PIN_A0
#define B PIN_A1
#define C PIN_A2
#define D PIN_A3
int Motor[4]={12,6,3,9};
set_tris_a(0x00);
While(1){
set_tris_b(ALL_OUT);
PORTB = 0; // Set all pins low
for(Motor=0;Motor<=3;++Motor) // Quickly count from 0 to 127
PORTB=Motor; // on the I/O port pin
set_tris_b(ALL_IN);
Motor = PORTB; // i now contains the portb value.
}
}byte Motor[4]={12,6,3,9};
int8 My_Index = 0; //usada como indice despues
set_tris_a(0x00);#include "C:\Documents and Settings\Fox\Mis documentos\PIC\Motor paso a paso.h"
void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
#Byte PORTA = 6
#Define ALL_OUT 0
#Define ALL_IN 0xff
byte Motor[4]={12,6,3,9};
int8 My_Index = 0; //usada como indice despues
set_tris_a(0x00);
While(1){
PORTA = 0; // Set all pins low
for(My_Index=0;My_Index<=3;My_Index++) // Quickly count from 0 to 3
PORTA=Motor[My_Index]; // on the I/O port pin
delay_ms(50);
}
}
#include <16F627A.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES RESERVED //Used to set the reserved FUSE bits
#use delay(clock=4000000)
# Byte PORTB = 6
# Define ALL_OUT 0
# Define ALL_IN 0xff
main () {
int i;
set_tris_b (ALL_OUT);
PORTB = 0; / / Establecer todos los pines bajos
for (i = 0; i <= 127; + + i) / / cuenta rápidamente de 0 a 127
PORTB = i; / / en el pin del puerto I / O
set_tris_b (ALL_IN);
i = PORTB; / / i ahora contiene el valor PORTB.
}
Recuerde al usar el # BYTE, la variable creada es tratada como la memoria. Usted debe mantener el control de los tres estados se registra a sí mismo a través de la función SET_TRIS_X.int i;en un array int i[4]={12,6,3,9};