Diagrama De Conexion De Pic Con Rs232

Páginas: 2 (321 palabras) Publicado: 31 de agosto de 2011
Diagrama de conexion de pic con RS232

PROGRAMA PARA EL MICROCONTROLADOR

#include "rs232.h"

int16 q;
float p;
void main()
{
setup_adc_ports(AN0);
setup_adc(adc_clock_internal);//setup_adc(ADC_Off);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);

while (1)
{
set_adc_channel(an0);
delay_us(20);
q=read_adc();
p=(q*5.0)/(1024.0);puts(p);
//delay_ms(100);
}
}

Programa visual para la comunicación en visual Basic

PROGRAMA PARA LA PC EN VISUAL BASIC

Public r As Variant
Public x As VariantPublic y As Variant
Public tiempo As Variant
Public dato As Variant

Private Sub Command1_Click()
Line (7535, 2735)-(1900, 2734)
Line (2550, 2735)-(2550, 0)
Timer1.Enabled = True
tiempo =Text1.Text
Timer1.Interval = tiempo
Command1.Enabled = False
Command2.Enabled = True
Text1.Enabled = False
End Sub

Private Sub Command2_Click()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen= False
End If
Cls
Text1.Text = ""
Text1.Enabled = True
Command1.Enabled = False
Command2.Enabled = False
End Sub

Private Sub Command3_Click()
If MSComm1.PortOpen = False ThenMSComm1.PortOpen = True
MsgBox "Se ha Abierto el puerto con Exito", , " Puerto "
End If
Command3.Enabled = False
End Sub

Private Sub Command4_Click()
Timer2.Enabled = True
End Sub
Private SubForm_Load()
If MSComm1.PortOpen = False Then
With MSComm1
.CommPort = 6
.Settings = "300,n,8,1"
.RThreshold = 1
.SThreshold = 0
End With
End If
Command1.Enabled = FalseCommand2.Enabled = False
MsgBox ("Introduce el intervalo de muestreo")
End Sub

Private Sub Form_Terminate()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
End Sub

Private Sub...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Conexion rs232
  • Diagramas de conexion
  • diagrama de conexiones entre dos microprocesadores
  • Diagrama Semaforo Con Pic
  • Rs232
  • Rs232
  • RS232
  • Rs232

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS