2000-10-01 12:52:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Very simple test program to check BCD convertion against some other --SF
|
|
|
|
* This is mainly to test freq2bcd and bcd2freq functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2000-10-08 21:43:00 +00:00
|
|
|
#include <hamlib/rig.h>
|
2001-02-11 23:25:37 +00:00
|
|
|
#include "misc.h"
|
2000-10-01 12:52:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
char b[5];
|
|
|
|
freq_t f=0;
|
|
|
|
|
|
|
|
if (argc != 2) {
|
2000-10-16 22:10:37 +00:00
|
|
|
fprintf(stderr,"Usage: %s <freq>\n",argv[0]);
|
2000-10-01 12:52:17 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
f = atoi(argv[1]);
|
|
|
|
|
2000-10-16 22:10:37 +00:00
|
|
|
printf("Little Endian mode\n");
|
2000-10-01 12:52:17 +00:00
|
|
|
printf("Frequency: %lld\n",f);
|
|
|
|
to_bcd(b, f, 10);
|
|
|
|
printf("BCD: %2.2x,%2.2x,%2.2x,%2.2x,%2.2x\n",b[0],b[1],b[2],b[3],b[4]);
|
|
|
|
printf("Result after recoding: %lld\n", from_bcd(b, 10));
|
|
|
|
|
2000-10-16 22:10:37 +00:00
|
|
|
printf("\nBig Endian mode\n");
|
|
|
|
printf("Frequency: %lld\n",f);
|
|
|
|
to_bcd_be(b, f, 10);
|
|
|
|
printf("BCD: %2.2x,%2.2x,%2.2x,%2.2x,%2.2x\n",b[0],b[1],b[2],b[3],b[4]);
|
|
|
|
printf("Result after recoding: %lld\n", from_bcd_be(b, 10));
|
|
|
|
|
2000-10-01 12:52:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|