/Designs/Measuring_instruments/RMDS02C/SW/PIC16F887/main.c
27,10 → 27,16
int8 address=0;
 
unsigned int16 of=0; // count of overflow
// configure GPS
void setup_GPS()
{
// 1x 100 us per 10 s UTC synchronised
const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x96, 0x98, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0xC6, 0x51};
int n;
for (n=0;n<40;n++) putc(cmd[n]);
}
 
// 1x 100 us per 10 s UTC synchronised
const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x96, 0x98, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0xC6, 0x51};
#INT_SSP
void ssp_interupt ()
{
76,6 → 82,8
if(state == 0x83) //Master is requesting data
{
i2c_write(buffer[3]); // Prepare next byte to SSP buffer
setup_GPS();
}
 
if(state > 0x83) //Master is requesting data
125,7 → 133,6
of++;
}
 
 
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
143,10 → 150,7
restart_wdt();
// setup GPS
{
int n;
for (n=0;n<40;n++) putc(cmd[n]);
}
setup_GPS();
 
ext_int_edge( L_TO_H ); // set 1PPS active edge
enable_interrupts(INT_TIMER1);
/Designs/Measuring_instruments/RMDS02C/SW/PIC16F887/main.hex
1,4 → 1,4
:1000000002308A00A12A0000FF00030E8301A10034
:1000000002308A00AF2A0000FF00030E8301A10026
:100010000A08A0008A010408A2007708A300780853
:10002000A4007908A5007A08A600831383120B1E8A
:100030001B288B1838288C308400001C21280C18B1
5,8 → 5,8
:100040003B288C308400801D27288C193E282208EC
:1000500084002308F7002408F8002508F900260882
:10006000FA0020088A00210E8300FF0E7F0E09008F
:100070008A110A12D4288A110A1295298A110A12A1
:100080007A280A108A100A118207B53462340634BD
:100070008A110A12E2288A110A12A3298A110A1285
:1000800087280A108A100A118207B53462340634B0
:10009000313420340034003400340034003432343D
:1000A0000034003400348034963498340034E03422
:1000B000C834103400346434003400340034003464
13,100 → 13,101
:1000C000003400340034003400340034003473341D
:1000D000003400340034C6345134130854089300FB
:1000E00014168C11831614187328F8018312141A2D
:1000F000F80A08008316941A85288312B60183161D
:10010000141D85288312B617831683123608B60A83
:10011000D20052087F3C031C972814138C1D8E2894
:1001200013081416D100520B97285108B300520837
:10013000803C031DB528B308031DA6282B08AF007B
:100140002C08B0002D08B1002E08B2003308043C82
:10015000031CB3282F303307840083130008D30017
:10016000D4006D20B528D4016D205208813C031DB8
:10017000BC283008D4006D205208823C031DC328DF
:100180003108D4006D205208833C031DCA28320870
:10019000D4006D205208833C0318D028D4016D2070
:1001A0008C118A110A1227283508D5003408D4008A
:1001B0000F08FA000E08F7000F087A02031DD8286E
:1001C0007708D1007A08D200D30183160910831270
:1001D00009108316891083128910281428088316A1
:1001E00087008312D3010718D30A831609108312DC
:1001F0000914281428088316870000308312071872
:100200000130F7000310F70D7708D30483160910A7
:100210008312091083168910831289142814280860
:10022000831687000030831207180130F700F70D9E
:10023000F70DFC30F7057708D304831609108312F5
:100240000914281428088316870000308312071821
:100250000130F700F70DF70DF70DF830F7057708C7
:10026000D30483160911831209118316091183120D
:1002700009158F018E01B501B401D901D8015508C6
:10028000D7005408D6005508D9005408D800D60124
:10029000D701D80DD90DD80DD90DD80DD90DD80D40
:1002A000D90DF030D805DE01DD01510DF700520DFA
:1002B000F8005D0DF9005E0DFA00F70DF80DF90D6F
:1002C000FA0DF70DF80DF90DFA0DF70DF80DF90D02
:1002D000FA0DF030F7057708D60778080318780F7D
:1002E000D70779080318790FD8077A0803187A0F07
:1002F000D907F801F901FA0153085607AB0057086E
:10030000AC0078080318780FAC075808AD007908DE
:100310000318790FAD075908AE007A0803187A0F51
:10032000AE078B108A110A122728B40A0319B50ADE
:100330000C108A110A1227280D05633BE1352E1790
:10034000AE060A0039308400831300080319B5296A
:100350000630F800F701F70BAB29F80BAA297B3020
:10036000F700F70BB129800BA829080083160317A3
:100370008C170C140000000083120C087F3903193D
:10038000FC290313B80003170D080313B900031762
:100390000F080313BA0038080C1ECC29990039083D
:1003A00003178D0003133A0803178F0083168C1769
:1003B0000C140000000083120C0D0E0D7F39031980
:1003C000FC290313B80003170D080313B900031722
:1003D0000F080313BA0038080C1EEC2999003908DD
:1003E00003178D0003133A0803178F008D0A0319B2
:1003F0008F0A0313B629031703138A110A123E2B1F
:10040000F701F801F901FA01CC01CD01CE01CF01CC
:100410004B084A044904480403193E2A2030D000FE
:100420000310C40DC50DC60DC70DCC0DCD0DCE0DE1
:10043000CF0D4B084F02031D272A4A084E02031D09
:10044000272A49084D02031D272A48084C02031C8D
:10045000382A4808CC024908031C490FCD024A0833
:10046000031C4A0FCE024B08031C4B0FCF02031490
:10047000F70DF80DF90DFA0DD00B102A4C30840051
:10048000831308000408BC003B30C3009A30C2004C
:10049000CA30C100C0010A30BE003B08C7003A089C
:1004A000C6003908C5003808C4004308CB0042081C
:1004B000CA004108C9004008C80000220008B8006E
:1004C000840A0008B900840A0008BA00840A0008F7
:1004D000BB00F708031D7F2A3E08013A03197F2A53
:1004E0003C080319802A0F393E020319792A0318A0
:1004F000862ABC1B862A3C1B802A2030812ABC010C
:100500003030F70777080C1E832A99004308C7008C
:100510004208C6004108C5004008C400CB01CA011A
:10052000C9010A30C80000227A08C3007908C20055
:100530007808C1007708C000BE0B4D2A8A110A1244
:10054000512B840183131F308305831603178715EE
:1005500008300313990002309A00A63098009030BA
:1005600083129800A815280883168700831228167E
:10057000280883168700A230930036308312940037
:10058000B301B501B401831603170908C039890006
:1005900003131F129F120030031788008312870174
:1005A000880189010313A701FF30A800A901AA014E
:1005B0000330B600831603170908C03989000313F6
:1005C0001F129F12003003178800831203131F109D
:1005D00083160108C73908388100093083120317D0
:1005E00085000F30F70003138101813084008313ED
:1005F0000008F0390738800064000008F739F7195F
:10060000F03977048000073090000030F800920045
:100610000030831692008312031787018801890135
:10062000831603139701640004308312B800FA3074
:10063000B900A221B80B172B6400B7013708273C7B
:10064000031C292B370841200C1E242B9900B70AC4
:100650001E2B831601170C1483120B1683168C1590
:10066000C03083128B04AF01B001B101B2019C30E4
:1006700003178D0001308F000313B6296400063084
:10068000B800FA30B900A221B80B412B4A308400DF
:100690002E08BB002D08BA002C08B9002B08B800A2
:1006A000422A0D300C1E522B99000A300C1E562B7C
:0606B00099003E2B6300DF
:1000F000F80A0800D3015308273C031C862853083C
:1001000041200C1E81289900D30A7B280800831601
:10011000941A92288312B7018316141D9228831211
:10012000B717831683123708B70AD20052087F3CEC
:10013000031CA42814138C1D9B2813081416D1002B
:10014000520BA4285108B4005208803C031DC22859
:10015000B408031DB3282C08B0002D08B1002E08E8
:10016000B2002F08B3003408043C031CC028303010
:100170003407840083130008D300D4006D20C22804
:10018000D4016D205208813C031DC9283108D400D8
:100190006D205208823C031DD0283208D4006D2007
:1001A0005208833C031DD8283308D4006D207A20E0
:1001B0005208833C0318DE28D4016D208C118A116B
:1001C0000A1227283608D5003508D4000F08FA008F
:1001D0000E08F7000F087A02031DE6287708D10001
:1001E0007A08D200D30183160910831209108316EE
:1001F0008910831289102914290883168700831215
:10020000D3010718D30A831609108312091429147D
:100210002908831687000030831207180130F70081
:100220000310F70D7708D304831609108312091001
:1002300083168910831289142914290883168700CC
:100240000030831207180130F700F70DF70DFC306E
:10025000F7057708D30483160910831209142914AB
:100260002908831687000030831207180130F70031
:10027000F70DF70DF70DF830F7057708D30483165F
:1002800009118312091183160911831209158F01AF
:100290008E01B601B501D901D8015508D70054081F
:1002A000D6005508D9005408D800D601D701D80D7A
:1002B000D90DD80DD90DD80DD90DD80DD90DF030D7
:1002C000D805DE01DD01510DF700520DF8005D0D7E
:1002D000F9005E0DFA00F70DF80DF90DFA0DF70DA6
:1002E000F80DF90DFA0DF70DF80DF90DFA0DF030C6
:1002F000F7057708D60778080318780FD707790825
:100300000318790FD8077A0803187A0FD907F8016C
:10031000F901FA0153085607AC005708AD007808F8
:100320000318780FAD075808AE0079080318790F45
:10033000AE075908AF007A0803187A0FAF078B1081
:100340008A110A122728B50A0319B60A0C108A1155
:100350000A1227280D05633BE1352E17AE060A0069
:1003600039308400831300080319C3290630F800CC
:10037000F701F70BB929F80BB8297B30F700F70B19
:10038000BF29800BB6290800831603178C170C149D
:100390000000000083120C087F3903190A2A031396
:1003A000B80003170D080313B90003170F08031350
:1003B000BA0038080C1EDA299900390803178D0095
:1003C00003133A0803178F0083168C170C140000D0
:1003D000000083120C0D0E0D7F3903190A2A031336
:1003E000B80003170D080313B90003170F08031310
:1003F000BA0038080C1EFA299900390803178D0035
:1004000003133A0803178F008D0A03198F0A031389
:10041000C429031703138A110A12472BF701F801A5
:10042000F901FA01CC01CD01CE01CF014B084A04FC
:100430004904480403194C2A2030D0000310C40D8D
:10044000C50DC60DC70DCC0DCD0DCE0DCF0D4B0876
:100450004F02031D352A4A084E02031D352A49085A
:100460004D02031D352A48084C02031C462A480841
:10047000CC024908031C490FCD024A08031C4A0F4D
:10048000CE024B08031C4B0FCF020314F70DF80DDF
:10049000F90DFA0DD00B1E2A4C308400831308008E
:1004A0000408BC003B30C3009A30C200CA30C1000F
:1004B000C0010A30BE003B08C7003A08C600390830
:1004C000C5003808C4004308CB004208CA004108F0
:1004D000C9004008C8000E220008B800840A0008BD
:1004E000B900840A0008BA00840A0008BB00F708B3
:1004F000031D8D2A3E08013A03198D2A3C08031971
:100500008E2A0F393E020319872A0318942ABC1B2E
:10051000942A3C1B8E2A20308F2ABC013030F707EA
:1005200077080C1E912A99004308C7004208C600AC
:100530004108C5004008C400CB01CA01C9010A3006
:10054000C8000E227A08C3007908C2007808C100EA
:100550007708C000BE0B5B2A8A110A125A2B84014D
:1005600083131F3083058316031787150830031381
:10057000990002309A00A6309800903083129800BB
:10058000A9152908831687008312291629088316BE
:100590008700A2309300363083129400B401B60174
:1005A000B501831603170908C039890003131F1208
:1005B0009F12003003178800831287018801890188
:1005C0000313A801FF30A900AA01AB010330B70053
:1005D000831603170908C039890003131F129F12DD
:1005E000003003178800831203131F1083160108BD
:1005F000C7390838810009308312031785000F308E
:10060000F700031381018130840083130008F0395F
:100610000738800064000008F739F719F0397704CB
:100620008000073090000030F80092000030831600
:10063000920083120317870188018901831603132F
:100640009701640004308312B800FA30B900B02179
:10065000B80B252B6400A7018B1BA7178B137A20DF
:10066000A71B8B17831601170C1483120B16831606
:100670008C15C03083128B04B001B101B201B301FB
:10068000AA3003178D0001308F000313C4296400C2
:100690000630B800FA30B900B021B80B4A2B4A3006
:1006A00084002F08BB002E08BA002D08B9002C08C2
:1006B000B800502A0D300C1E5B2B99000A300C1E1E
:0806C0005F2B9900472B63003A
:04400E00EA2CFF3F5A
:00000001FF
;PIC16F887
;CRC=F2B1 CREATED="21-II-14 12:29"
;CRC=E464 CREATED="16-Oct-14 22:09"