No changes between revisions
/Designs/Measuring_instruments/ACOUNTER02A/PrjInfo.txt
0,0 → 1,13
[InfoShortDescription.en]
Atomic frequency Counter with PIC
 
[InfoShortDescription.cs]
Atomový čítač s PICem
 
[InfoLongDescription.en]
A Counter to 800 MHz synchonised by GPS with 0.1 ppm accuracy. Frequency range can be expanded by adding additional divider module (CLKDIV01A).
 
[InfoLongDescription.cs]
Měřič frekvence do 800 MHz opřený o kmitočtový normál GPS s přesností 0.1 ppm. Frekvenční rozsah může být rozšířen přidáním další předděličky (CLKDIV01A).
 
[End]
/Designs/Measuring_instruments/ACOUNTER02A/SW/PIC16F887/acounter.c
0,0 → 1,113
//*** Atomic counter up to 800 MHz ***
#include "acounter.h"
#include <string.h>
 
#define LED PIN_C1 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
#define SEL0 PIN_E0 // external counter division ratio
#define SEL1 PIN_E1 // external counter division ratio
#define MR PIN_E2 // external counter master reset
#define CLKI PIN_C0 // internal counter input
#define BEEP PIN_C3 // buzzer
 
// LCD definitions
#define LCD_ENABLE_PIN PIN_D4 ////
#define LCD_RS_PIN PIN_D6 ////
#define LCD_RW_PIN PIN_D5 ////
#define LCD_DATA4 PIN_D0 ////
#define LCD_DATA5 PIN_D1 ////
#define LCD_DATA6 PIN_D2 ////
#define LCD_DATA7 PIN_D3
#include <lcd.c>
 
int16 of=0; // count of overflow
int1 flag; // flag for a blinking dot
 
// GPS setup for frequency measurement
const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x84, 0x1E, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x40, 0x42, 0x0F, 0x00, 0xA0, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0x00, 0x00, 0x00, 0x12, 0x03};
 
 
#int_EXT // Interrupt from 1PPS
void EXT_isr(void)
{
unsigned int16 countH;
unsigned int8 countL;
unsigned int32 count;
char countS[10], a[4], b[4], c[4]; // strings for printing results
countL=0;
countH=get_timer1(); // read internal counter
output_low(SEL0);
output_low(SEL1);
countL=input(CLKI); // read bit 0 of external counter
output_high(SEL0);
output_low(SEL1);
countL|=input(CLKI)<<1; // read bit 1 of external counter
output_low(SEL0);
output_high(SEL1);
countL|=input(CLKI)<<2; // read bit 2 of external counter
output_high(SEL0);
output_high(SEL1);
countL|=input(CLKI)<<3; // read bit 3 of external counter
 
output_low(MR); // External counter Master Reset
output_high(MR);
set_timer1(0); // Internal counter reset
count=((unsigned int32)of<<20)+((unsigned int32)countH<<4)+(unsigned int32)countL; // concatenate
 
sprintf(countS,"%09Lu", count); // engeneering values conversion
strncpy(a, countS, 3); a[3]='\0';
strncpy(b, &countS[3], 3); b[3]='\0';
strncpy(c, &countS[6], 3); c[3]='\0';
printf("%s\r\n", countS); // output to RS232
if(flag==0){lcd_putc("\fCvak... \n"); flag=1;} else {lcd_putc("\fCvak....\n"); flag=0;};
printf(lcd_putc, "%s %s %s Hz\n", a, b, c); // output to LCD
 
output_toggle(BEEP); // cvak...
 
of=0; // reset overflow counter
}
 
#int_TIMER1 // Interrupf from overflow
void TIMER1_isr(void)
{
of++;
}
 
void main()
{
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
 
output_toggle(BEEP); // cvak...
ext_int_edge( L_TO_H ); // set 1PPS active edge
enable_interrupts(INT_TIMER1);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
 
lcd_init();
delay_ms(100);
lcd_putc("\f ACOUNTER02A\n (c)mlab.cz 2014\n");
 
 
delay_ms(1000); //wait for GPS init.
int n;
for (n=0;n<40;n++) putc(cmd[n]); // send setup to GPS
 
lcd_putc("\fCvak...\nHmmm...\n");
 
while(true)
{
}
 
}
/Designs/Measuring_instruments/ACOUNTER02A/SW/PIC16F887/acounter.hex
0,0 → 1,214
:1000000005308A005C2D0000FF00030E8301A10073
:100010000A08A0008A010408A2007708A300780853
:10002000A4007908A5007A08A600831383120B1E8A
:100030001B288B1832288C308400001C21280C18B7
:100040003528220884002308F7002408F800250832
:10005000F9002608FA0020088A00210E8300FF0E0E
:100060007F0E09008A110A12532A8A110A12E32C00
:100070000A108A100A11820728340C34013406341D
:100080000A108A100A118207B534623406343134FA
:10009000203400340034003400340034323400346E
:1000A00000340034803484341E340034E034C834E6
:1000B00010340034403442340F340034A0348634D9
:1000C000013400340034003400340034F734003498
:1000D0000034003412340334F701F801F901FA0155
:1000E000F101F201F301F40170086F046E046D0474
:1000F0000319AA282030F5000310E90DEA0DEB0DD5
:10010000EC0DF10DF20DF30DF40D70087402031DEA
:1001100093286F087302031D93286E087202031D53
:1001200093286D087102031CA4286D08F1026E0863
:10013000031C6E0FF2026F08031C6F0FF3027008AE
:10014000031C700FF4020314F70DF80DF90DFA0DEE
:10015000F50B7C2871308400831308005E08E300EF
:100160005D08E200E1080319DD286008FA005F0875
:10017000840083137A18831780080319DD28630825
:10018000FA006208E20A0319E30AE4007A08E500CB
:100190006008FA005F08DF0A0319E00A840083138D
:1001A0007A1883170008E600640884008313651832
:1001B000831766088000E103B228E1080319ED28DF
:1001C0006308FA006208E20A0319E30A8400831351
:1001D0007A1883178001E103DD285D08F8005E08C6
:1001E000F90008006918F6280810F7280814831683
:1001F00008108312E918FE288810FF288814831637
:100200008810831269190629081107290815831611
:1002100008118312E9190E2988110F2988158316F0
:100220008811000083120816831608120330F700A5
:10023000F70B18298312081283160812831208007C
:1002400083160812081388128312081383160813E2
:1002500008148814081588158312881683168812C6
:100260000000831208168316081200008312EA01A8
:10027000831608140030831208180130EA0483162C
:1002800088140030831288180130F7000310F70D2E
:100290007708EA0483160815003083120819013024
:1002A000F700F70DF70DFC30F7057708EA04831621
:1002B00088150030831288190130F700F70DF70D0B
:1002C000F70DF830F7057708EA046A08F8007808AF
:1002D000E90008128316081200008312081683161C
:1002E00008127229732900008312EA018316081488
:1002F0000030831208180130EA0483168814003095
:10030000831288180130F7000310F70D7708EA040C
:10031000831608150030831208190130F700F70D15
:10032000F70DFC30F7057708EA04831688150030CE
:10033000831288190130F700F70DF70DF70DF8302B
:10034000F7057708EA046A08F8007808E800081258
:100350008316081208108810081188118312690E7C
:10036000F700F030F70577086804F8007808E8002F
:10037000E81FBC2983162829E608031DC129081394
:10038000C2290817831608130000831288128316E7
:100390008812000083120812831608128312670E57
:1003A000E8000F30E8056808E900F22067080F3917
:1003B000E800E900F220080062308400831300089E
:1003C0000319EF290630F800F701F70BE529F80BC0
:1003D000E4297B30F700F70BEB29800BE2290800BA
:1003E0006108073A0319FE290B3A0319132A063A42
:1003F00003191B2A023A0319312A362A0130E20076
:10040000E300630B042A072A4030E400082AE401D1
:1004100001306202E40764088038E500E6016508FF
:10042000E70020213C2AE6010130E70020210230CC
:10043000E200DC213C2A0130E2000230E300630BE1
:10044000222A252A4030E400262AE40101306202F3
:10045000E40764088038E500E6016508E70020212C
:100460003C2AE6011030E70020213C2A0130E6005A
:100470006108E70020213C2A080080080319522A5D
:10048000DE010408DD005E10831B5E140008E1003D
:10049000F0215D08840083135E188317840A031912
:1004A000850A3D2A0800C2010F08FA000E08F7006D
:1004B0000F087A02031D542A7708C0007A08C10089
:1004C000831609108312091083168910831289106C
:1004D0002E142E08831687008312C2010718C20A41
:1004E0008316091083120914831689108312891048
:1004F0002E142E088316870000308312071801304F
:10050000F7000310F70D7708C20483160910831251
:10051000091083168910831289142E142E0883164D
:1005200087000030831207180130F700F70DF70D30
:10053000FC30F7057708C2048316091083120914EA
:1005400083168910831289142E142E0883168700AF
:100550000030831207180130F700F70DF70DF70D83
:10056000F830F7057708C2048316091183120911C0
:1005700083160911831209158F018E01E001DF0135
:100580002C08DE002B08DD002C08E0002B08DF0023
:10059000DD01DE01DF0DE00DDF0DE00DDF0DE00D13
:1005A000DF0DE00DF030DF05E501E401400DF7005F
:1005B000410DF800640DF900650DFA00F70DF80D16
:1005C000F90DFA0DF70DF80DF90DFA0DF70DF80DFF
:1005D000F90DFA0DF030F7057708DD0778080318F4
:1005E000780FDE0779080318790FDF077A080318F8
:1005F0007A0FE007F801F901FA0142085D07C3002C
:100600005E08C40078080318780FC4075F08C500A7
:1006100079080318790FC5076008C6007A0803181F
:100620007A0FC607B0014730AF0049308400460852
:10063000E0004508DF004408DE004308DD00040850
:10064000E1003B30E8009A30E700CA30E600E501FF
:100650000A30E3006008EC005F08EB005E08EA0087
:100660005D08E9006808F0006708EF006608EE0022
:100670006508ED006C2078080008DD00840A000899
:10068000DE00840A0008DF00840A0008E000FD3074
:100690008407F708031D5F2B6308013A03195F2BDA
:1006A00061080319602B0F3963020319592B0318D2
:1006B000702BE11B702B611B602B2030612BE10143
:1006C0003030F7077708E9002F08840083133018CB
:1006D000831769088000840A8001AF0A0319B00AF1
:1006E0006808EC006708EB006608EA006508E900A6
:1006F000F001EF01EE010A30ED006C207A08E8000D
:100700007908E7007808E6007708E500E30B2A2B74
:10071000DE015130DD00E0014730DF000330E10051
:10072000AE20D401DE015530DD00E0014A30DF00AB
:100730000330E100AE20D801DE015930DD00E001D8
:100740004D30DF000330E100AE20DC014730840093
:10075000831380080319BF2BDE010408DD005E103F
:10076000831B5E1400080C1EB32B99005D088400E7
:1007700083135E188317840A0319850AA92B0D3089
:100780000C1EC02B99000A300C1EC42B99002D188A
:10079000122CD03003178D0004308F0083168C1775
:1007A0000C140000000083120C087F3903190F2C71
:1007B0000313DD0003170D080313DE0003170F08F2
:1007C0000313DF005D08E100F0215E0803178D00D0
:1007D00003135F0803178F0083168C170C14000097
:1007E000000083120C0D0E0D7F3903190F2C03131B
:1007F000DD0003170D080313DE0003170F080313B2
:10080000DF005D08E100F0215E0803178D0003138F
:100810005F0803178F008D0A03198F0ACE2B03136D
:100820002D145A2CD63003178D0004308F008316F8
:100830008C170C140000000083120C087F39031978
:10084000582C0313DD0003170D080313DE000317F4
:100850000F080313DF005D08E100F0215E080317B5
:100860008D0003135F0803178F0083168C170C1479
:100870000000000083120C0D0E0D7F390319582C57
:100880000313DD0003170D080313DE0003170F0821
:100890000313DF005D08E100F0215E0803178D00FF
:1008A00003135F0803178F008D0A03198F0A172C93
:1008B00003132D105130840083133D222030E100BA
:1008C000F0215530840083133D222030E100F021D7
:1008D0005930840083133D22E03003178D0004302B
:1008E0008F00031004300313DD00831603178C17E9
:1008F0000C14000000000318A42C83120C087F398C
:100900000313DE0003170D080313DF0003170F089E
:100910000313E0005E08E100F0215F0803178D007B
:100920000313600803178F0083168C170C14000044
:10093000000083120313DD0B9E2CA12C83160317DA
:10094000A42CC32C8316031783120C0D0E0D7F39B4
:100950000313DE0003170D080313DF0003170F084E
:100960000313E0005E08E100F0215F0803178D002B
:100970000313600803178F008D0A03198F0A0310F1
:100980000313DD0B752CAE112E088316870008307B
:1009900083128706AC01AB018B108A110A12212841
:1009A0008C21F6306B172E17200500008C21F630B5
:1009B0006B172E172E050001A539A0127310A5394B
:1009C00020247A050000AB0A0319AC0A0C108A1126
:1009D0000A1221280C10A020C3275527D422521810
:1009E000B2200A10A831A936EC306217633D2019F5
:1009F000B018340500018C21F6306B172E170A242D
:100A0000ED366D172E170A0083160810881008118E
:100A1000881108120813881283120813831608130A
:100A20008312881283168812831208128316081202
:100A30008312A7018B1BA7178B130F30E200DC2159
:100A4000A71B8B170130B2003208033C031C3C2D5E
:100A5000A7018B1BA7178B130330E900F220A71BFC
:100A60008B17A7018B1BA7178B130530E200DC2126
:100A7000A71B8B17B20A242DA7018B1BA7178B135B
:100A80000230E900F220A71B8B17B2013208033CA9
:100A9000031C592D32083820B300A7018B1BA71760
:100AA0008B13E6013308E7002021A71B8B17B20A3E
:100AB000462D8A110A12DC2D840183131F30830511
:100AC00083160317871508300313990002309A0024
:100AD000A6309800903083129800AC01AB018316C9
:100AE00003170908C039890003131F129F12003031
:100AF0000317880083128701880189010313A80165
:100B0000A901AA01FF30AE00AF01B001831603179F
:100B10000908C039890003131F129F120030031700
:100B20008800831203131F139F1383169F138312CE
:100B30001F149412AE122E088316870083122E16ED
:100B40002E08831687008312AE112E0883168700A5
:100B50000130831294000030831694000108C739D5
:100B6000083881000730831290000030F8009200AE
:100B700000308316920083122E152E0883168700EC
:100B80008312970183169B019C0101309D00831203
:100B900003178701880189010313AE112E088316FC
:100BA0008700083083128706831601170C148312FE
:100BB0000B16C0308B04042DA7018B1BA7178B13BA
:100BC0006430E200DC21A71B8B17EA3003178D008D
:100BD00004308F0083168C170C1400000000831261
:100BE0000C087F3903192B2E0313DD0003170D08A2
:100BF0000313DE0003170F080313DF005D08E10095
:100C0000F0215E0803178D0003135F0803178F00A0
:100C100083168C170C140000000083120C0D0E0DAF
:100C20007F3903192B2E0313DD0003170D0803135F
:100C3000DE0003170F080313DF005D08E100F02159
:100C40005E0803178D0003135F0803178F008D0ADA
:100C500003198F0AEA2D04300313B200A7018B1B7E
:100C6000A7178B13FA30E200DC21A71B8B17B20BFE
:100C70002E2EB1013108273C031C452E310840209F
:100C80000C1E402E9900B10A3A2EFB3003178D003E
:100C900004308F0083168C170C14000000008312A0
:100CA0000C087F3903198B2E0313DD0003170D0881
:100CB0000313DE0003170F080313DF005D08E100D4
:100CC000F0215E0803178D0003135F0803178F00E0
:100CD00083168C170C140000000083120C0D0E0DEF
:100CE0007F3903198B2E0313DD0003170D0803133F
:100CF000DE0003170F080313DF005D08E100F02199
:100D00005E0803178D0003135F0803178F008D0A19
:0A0D100003198F0A4A2E8B2E630090
:04400E00F22CFF3F52
:00000001FF
;PIC16F887
;CRC=1DAD CREATED="01-II-14 17:36"
/Designs/Measuring_instruments/ACOUNTER02A/SW/PIC16F887/acounter.pjt
0,0 → 1,30
[PROJECT]
Target=acounter.hex
Development_Mode=
Processor_Text=PIC16F887
ToolSuite=CCS
Processor=0x887F
[acounter]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
[mru-list]
1=acounter.c
[Windows]
0=0000 %S 0 0 796 451 3 0
[Units]
Link=0
Count=1
1=acounter
[Opened Files]
1=acounter.c
2=acounter.h
3=C:\Program Files\PICC\devices\16F887.h
4=C:\Program Files\PICC\drivers\string.h
5=C:\Program Files\PICC\drivers\stddef.h
6=C:\Program Files\PICC\drivers\ctype.h
7=C:\Program Files\PICC\drivers\lcd.c
8=
/Designs/Measuring_instruments/ACOUNTER02A/SW/PIC16F887/acounter.h
0,0 → 1,20
#include <16F887.h>
#device adc=8
 
#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 MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOCPD //No EE protection
#FUSES NOBROWNOUT //No brownout reset
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOWRT //Program memory not write protected
#FUSES BORV40 //Brownout reset at 4.0V
 
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors)
 
/Designs/Measuring_instruments/ACOUNTER02A/TODO.txt
0,0 → 1,3
Doplnit zobrazeni casu na displeji.
Vypisovat namerene hodnoty spolecne s casem na seriovou linku
Pridat funkci tlacitek, kdy se na zmacknuti tlacitka z gps vycte aktualni presny cas (melo by to byt vhodne pro znackovani udalosti). (Tohle by mela umet primo GPS, ma interrupt vstup)
/Designs/Measuring_instruments/ACOUNTER02A/ACOUNTER01A_on_Small.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Measuring_instruments/ACOUNTER02A/ACOUNTER02A_Small.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Measuring_instruments/ACOUNTER02A/DOC/img/ACOUNTER01A_off_Big.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Measuring_instruments/ACOUNTER02A/DOC/img/ACOUNTER01A_on_Big.JPG
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Designs/Measuring_instruments/ACOUNTER02A/DOC/u-center_settings.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property