Datalogger PIC16F876A

El circuito presente se trata de un voltímetro de 0 a 5v con la idea de estudiar el ADC del microcontrolador y la interfase RS232, este sistema fue testeado con un sensor de temperatura con el fin de crear una curva de inercia de temperatura de un horno eléctrico.
Como se puede ver en los graficos en función de una tabla de valores completada por el datalogger y el tiempo de las muestras se logra trazar la curva que el sensor entrega.
El circuito es extremadamente simple y la programacion del microcontrolador se realizo en lenguaje C para facilitar aun mas al dispositivo.


#include <16F876A.h>
#device adc=10
#FUSES XT,NOWDT
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=pin_c6, rcv=pin_c7, bits=8, parity=N)
#include
#define LED0 PIN_C0
#define LED1 PIN_C1
void main() {
int16 q;
float p;
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_2);
lcd_init();
printf(lcd_putc, " ElectGPL \a");
output_high(LED1);
delay_ms(60);
output_low(LED1);
delay_ms(60);
output_high(LED1);
delay_ms(60);
output_low(LED1);
delay_ms(60);
output_high(LED1);
delay_ms(1000);
for (;;) {
set_adc_channel(0);
delay_us(10);
q = read_adc();
p = 5.0 * q / 1024.0;
if (q == 1)
p = 0;
printf(lcd_putc, "Tension RS232 ON\n");
printf(lcd_putc, "5Vmax %02.5fV ", p);
printf("%02.5f \n", p);
delay_ms(20);
output_low(LED0);
delay_ms(20);
output_high(LED0);
}
}

-------------------------
Archivo "*.hex":


:1000000004308A00EF2C00000A108A100A118207BF
:1000100028340C3401340634201020104536E531E4
:10002000F4235026201020100700D432EE39E9378F
:100030006E10D229B21932104F270A00352BED303D
:100040007810201025183217353356102010000074
:10005000353084008313000803193C280130F80070
:10006000F701F70B3128F80B30284A30F700F70B6F
:1000700037283A28800B2E2808003C0EF039F7006C
:100080000F30060577048600000006144728061086
:1000900008000608F700060E0F39F800080083165E
:1000A000061086100611831286100F30831606057F
:1000B000F03886008312061500000614000049205F
:1000C0007808BC00061000000614000049207808DB
:1000D000BB0006100F3083160605860083123C0E07
:1000E000F700F030F70577083B04F8007808BB000C
:1000F000BB1B5528391C86103918861400000611C0
:10010000000006103A0EBB000F30BB053B08BC00D8
:100110003D203A080F39BB00BC003D2008000F30DD
:1001200083160605860006108610061183128610B7
:10013000061106100F30B50028200130A70027084F
:10014000033C031CAB280330BC003D200530B50048
:100150002820A70A9F280230BC003D20A7012708BD
:10016000033C031CBC2827080420A800B901280868
:10017000BA004F20A70AAF288A110A12132D360B96
:10018000C228C5284030B700C628B7010130350263
:10019000B70737088038B800B9013808BA004F20CF
:1001A00008003408073A0319DF280B3A0319E4283A
:1001B000063A0319EC28023A0319F228F72801300D
:1001C000B500B600BF20FD28B9010130BA004F20AC
:1001D0000230B5002820FD280130B5000230B600FD
:1001E000BF20FD28B9011030BA004F20FD28013092
:1001F000B9003408BA004F20FD2808008316031701
:100200008C170C140000000083120C087F390319AE
:1002100042290313A70003170D080313A8000317AF
:100220000F080313A9002708B400D12028080317DA
:100230008D000313290803178F0083168C170C14E5
:100240000000000083120C0D0E0D7F3903194229A6
:100250000313A70003170D080313A80003170F08C3
:100260000313A9002708B400D120280803178D0024
:100270000313290803178F008D0A03198F0A03132C
:10028000FE280317031308008E30F7002808F80033
:100290002708F900FA01F808031D58297908F80021
:1002A000F9010830F702F808031D5829F701602901
:1002B0000310F81B5F29F90DF80DF7035829F813FF
:1002C0008A110A12632D34080319D329BC00380897
:1002D0000319D329BC07031874297F30BC02031CFF
:1002E000D3290319D32978298130BC070318D329CE
:1002F0003C08F700F801F901FA013508C000C01701
:100300003608BF003708BE001830BC00BD013E1CD7
:10031000A1293B08FA07031C9329F90A031D932915
:10032000F80A0319BD173A08F907031C9A29F80AB5
:100330000319BD173908B600B6173608F8070318B1
:10034000BD17BD0DF80CF90CFA0CC00CBF0CBE0C9F
:100350000310BC0B86290130F7070318D329F81BBB
:10036000B829C00DFA0DF90DF80DF7030319D329BB
:10037000C01FC929FA0A031DC929F90A031DC92981
:10038000F80A031DC929F80CF90CFA0CF70A03192D
:10039000D3293508BD003908BD06BD1FD129F8177E
:1003A000D729F813D729F701F801F901FA01080054
:1003B0002B0803199D2AB7002F0803199D2AB7029D
:1003C000031CE7297F30B70703189D2AED298130E8
:1003D000B702031C9D2A03199D2A3708F700F8016C
:1003E000F901FA01B6012C08B500B5172D08B400C3
:1003F0002E08B3001930B7003208B3020318102AD0
:100400000130B4020318102AB5020318102AB602EC
:100410000318102AB60AB50AB40A3208B307422AEA
:100420003108B40203182B2A0130B50203182B2A15
:10043000B60203182B2AB60AB50A3108B4073208E7
:10044000B307031C422AB40A031D422AB50A031D3E
:10045000422AB60A422A30088038B5020318412AD7
:100460000130B6020318412AB60A30088038B507B1
:100470003108B407031C1F2AB50A031D1F2AB60A38
:100480001F2A7A14B70B452A502A0310B30DB40D56
:10049000B50DB60D0310FA0DF90DF80DB80DFC29C8
:1004A000381C582A0310F80CF90CFA0CB80C5B2A0B
:1004B000F70303199D2AB81B842A0310B30DB40D4A
:1004C000B50DB60D3208B3020318702A0130B4021C
:1004D0000318702AB5020318702AB602031C932A67
:1004E0003108B40203187B2A0130B50203187B2AB5
:1004F000B602031C932A30088038B5020318842AF8
:100500000130B602031C932AFA0A031D932AF90A42
:10051000031D932AF80A031D932AF70A03199D2A3B
:10052000F80CF90CFA0C2C08B7003008B706B71F06
:100530009B2AF817A12AF813A12AF701F801F9015B
:10054000FA018A110A12872D831603178C170C14CF
:10055000000000000318D32A83120C087F3903130C
:10056000A80003170D080313A90003170F080313AE
:10057000AA002808B400D120290803178D0003130E
:100580002A0803178F0083168C170C140000000034
:1005900083120313A70BCD2AD02A83160317D32A5D
:1005A000F22A8316031783120C0D0E0D7F390313E5
:1005B000A80003170D080313A90003170F0803135E
:1005C000AA002808B400D120290803178D000313BE
:1005D0002A0803178F008D0A03198F0A03100313CB
:1005E000A70BA42A08003408B63CB400FA01350869
:1005F000B800B5170310B50CB60CB70CFA0CF90C13
:10060000F80CF70CB40BFA2AB81F112BF709F809EC
:10061000F909FA09F70A0319F80A0319F90A03197B
:10062000FA0A08008318172B3C3084008313F70163
:10063000F801F901FA01BC01BD01BE01BF013B088F
:100640003A04390438040319552B2030C000031034
:10065000B40DB50DB60DB70DBC0DBD0DBE0DBF0D66
:100660003B083F02031D3E2B3A083E02031D3E2B72
:1006700039083D02031D3E2B38083C02031C4F2B5A
:100680003808BC023908031C390FBD023A08031CA4
:100690003A0FBE023B08031C3B0FBF020314F70DC9
:1006A000F80DF90DFA0DC00B272B3C088000840AC9
:1006B0003D088000840A3E088000840A3F088000CC
:1006C00008000408AC002B08AE000319802B2A0890
:1006D000B7002908B6002808B5002708B400BB01F8
:1006E000BA012030B9008230B80063217A08AA002C
:1006F0007908A9007808A8007708A700AE0B672B37
:100700002A08B7002908B6002808B5002708B40051
:10071000F3227A08AA007908A9007808A8007708C7
:10072000A700AA1FA02BAC03AC16A709A809A9090A
:10073000AA09A70A0319A80A0319A90A0319AA0AE8
:100740003B30B3009A30B200CA30B100B0010A3079
:10075000AE002B080319AC0A8314273084008313DE
:100760002A08B7002908B6002808B5002708B400F1
:100770003308BB003208BA003108B9003008B800AD
:1007800012237808F708031DD82B2B0A2E02031911
:10079000D82B2C080319DA2B0F392E020319D22B70
:1007A00003180A2CAC1B0A2C2C1BDA2B2030062C2D
:1007B0002030AC05AC1EE82BAC122B08031DAC039B
:1007C0007708AC002D30B400D1202C08F700AC0124
:1007D0002B082E02031DF62B7708AC002E30B40038
:1007E000D1202C08F7002030AC0500303030AC1E92
:1007F000062CAC122B08031DAC037708AC002D307F
:10080000B400D1202C08F700AC013030F70777088E
:10081000B400D12083103308B7003208B600310885
:10082000B5003008B400BB01BA01B9010A30B80004
:1008300012237A08B3007908B2007808B10077086B
:10084000B000AE0BAC2B8A110A12B62D0408AC0016
:100850002B08AE000319452C2A08B7002908B6005A
:100860002808B5002708B400BB01BA012030B90040
:100870008230B80063217A08AA007908A9007808B4
:10088000A8007708A700AE0B2C2C2A08B70029086F
:10089000B6002808B5002708B400F3227A08AA0099
:1008A0007908A9007808A8007708A700AA1F652C76
:1008B000AC03AC16A709A809A909AA09A70A031934
:1008C000A80A0319A90A0319AA0A3B30B3009A30EF
:1008D000B200CA30B100B0010A30AE002B080319D3
:1008E000AC0A83142730840083132A08B700290830
:1008F000B6002808B5002708B4003308BB0032084A
:10090000BA003108B9003008B80012237808F70897
:10091000031D9D2C2B0A2E0203199D2C2C08031954
:100920009F2C0F392E020319972C0318D32CAC1BC4
:10093000D32C2C1B9F2C2030CE2C2030AC05AC1E91
:10094000AE2CAC122B08031DAC037708AC002D3085
:100950000C1EA82C99002C08F700AC012B082E02C5
:10096000031DBD2C7708AC002E300C1EB52C990051
:100970002C08F7002030AC0500303030AC1ECE2CF7
:10098000AC122B08031DAC037708AC002D300C1EF5
:10099000C72C99002C08F700AC013030F707770816
:1009A0000C1ED02C990083103308B7003208B60013
:1009B0003108B5003008B400BB01BA01B9010A30F2
:1009C000B80012237A08B3007908B2007808B100A1
:1009D0007708B000AE0B712C8A110A12CD2D84015C
:1009E00083131F308305193083169900A6309800B1
:1009F00090308312980083161F149F141F159F11A7
:100A000007309C00FF308312A00083161F109F1434
:100A10001F159F151F1383121F139F1383169F17F4
:100A200083121F148F280C3003178D0000308F00A5
:100A30000313FE20A010200883168700831287145A
:100A40003C30B5002820A0102008831687008312B0
:100A500087103C30B5002820A0102008831687009E
:100A6000831287143C30B5002820A010200883167C
:100A70008700831287103C30B5002820A010200882
:100A800083168700831287140430A700FA30B5005C
:100A90002820A70B462D0030F8001F08C73978041E
:100AA0009F000330F700F70B532D1F151F19562D0C
:100AB00083161E088312A1001E08A2002208A800A7
:100AC0002108A7004429B701B6012030B5008130C4
:100AD000B4007A08BB007908BA007808B900770832
:100AE000B80063217708A7007808A8007908A90052
:100AF0007A08AA00AE007908AD007808AC00770843
:100B0000AB00B201B101B0018930AF00D8297A0839
:100B1000A6007908A5007808A4007708A300210B97
:100B2000982DA208031D982DA601A501A401A301DB
:100B3000153003178D0000308F000313FE201E3088
:100B400003178D0000308F00031008300313A70037
:100B5000A422C93084002608AA002508A900240878
:100B6000A8002308A7000530AB00612B2530031730
:100B70008D0000308F00031004300313A700A4225F
:100B8000C93084002608AA002508A9002408A80066
:100B90002308A7000530AB00262C20300C1ECE2DDC
:100BA00099000A300C1ED22D99001430B50028206F
:100BB0002010200883168700831207101430B50018
:100BC00028202010200883168700831207144B2D3D
:020BD0006300C0
:02400E00713F00
:00000001FF
;PIC16F876A
;CRC=F8E6 CREATED="27-Mar-11 17:47"

No hay comentarios.:

Publicar un comentario