Subversion Repositories svnkaklik

Compare Revisions

No changes between revisions

Ignore whitespace Rev 658 → Rev 659

/programy/C/PIC_C/hack/hack.BAK
File deleted
/programy/C/PIC_C/hack/hack.PJT
File deleted
/programy/C/PIC_C/hack/hack.LST
File deleted
/programy/C/PIC_C/hack/hack.c
File deleted
/programy/C/PIC_C/hack/hack.HEX
File deleted
/programy/C/PIC_C/hack/hack.sta
File deleted
/programy/C/PIC_C/hack/hack.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/hack/hack.h
File deleted
/programy/C/PIC_C/hack/hack.err
File deleted
/programy/C/PIC_C/hack/hack.SYM
File deleted
/programy/C/PIC_C/hack/hack.tre
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.tre
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/prg.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/motory/DC/regulator_letadlo/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.PJT
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.BAK
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.c
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.LST
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.HEX
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.h
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.sta
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.err
File deleted
/programy/C/PIC_C/motory/DC/regulator_letadlo/main.SYM
File deleted
/programy/C/PIC_C/motory/krokac/KROKAC.HEX
File deleted
/programy/C/PIC_C/motory/krokac/KROKAC.H
File deleted
/programy/C/PIC_C/motory/krokac/A.BAT
File deleted
/programy/C/PIC_C/motory/krokac/KROKAC.PJT
File deleted
/programy/C/PIC_C/motory/krokac/KROKAC.LST
File deleted
/programy/C/PIC_C/motory/krokac/KROKAC.C
File deleted
/programy/C/PIC_C/motory/hodinovy/main.HEX
File deleted
/programy/C/PIC_C/motory/hodinovy/main.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/motory/hodinovy/Run.BAT
File deleted
\ No newline at end of file
/programy/C/PIC_C/motory/hodinovy/main.h
File deleted
/programy/C/PIC_C/motory/hodinovy/main.sta
File deleted
/programy/C/PIC_C/motory/hodinovy/main.err
File deleted
/programy/C/PIC_C/motory/hodinovy/main.SYM
File deleted
/programy/C/PIC_C/motory/hodinovy/main.tre
File deleted
/programy/C/PIC_C/motory/hodinovy/prg.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/motory/hodinovy/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/motory/hodinovy/main.PJT
File deleted
/programy/C/PIC_C/motory/hodinovy/main.BAK
File deleted
/programy/C/PIC_C/motory/hodinovy/main.c
File deleted
/programy/C/PIC_C/motory/hodinovy/main.LST
File deleted
/programy/C/PIC_C/motory/menice/main.tre
File deleted
/programy/C/PIC_C/motory/menice/prg.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/motory/menice/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/motory/menice/main.PJT
File deleted
/programy/C/PIC_C/motory/menice/main.BAK
File deleted
/programy/C/PIC_C/motory/menice/main.c
File deleted
/programy/C/PIC_C/motory/menice/main.LST
File deleted
/programy/C/PIC_C/motory/menice/main.HEX
File deleted
/programy/C/PIC_C/motory/menice/main.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/motory/menice/Run.BAT
File deleted
\ No newline at end of file
/programy/C/PIC_C/motory/menice/main.h
File deleted
/programy/C/PIC_C/motory/menice/main.sta
File deleted
/programy/C/PIC_C/motory/menice/main.err
File deleted
/programy/C/PIC_C/motory/menice/main.SYM
File deleted
/programy/C/PIC_C/PICcam/873/camerus.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/PICcam/873/camerus.h
File deleted
/programy/C/PIC_C/PICcam/873/camerus.sta
File deleted
/programy/C/PIC_C/PICcam/873/camerus.err
File deleted
/programy/C/PIC_C/PICcam/873/camerus.sym
File deleted
/programy/C/PIC_C/PICcam/873/camerus.tre
File deleted
/programy/C/PIC_C/PICcam/873/camerus.BAK
File deleted
/programy/C/PIC_C/PICcam/873/camerus.PJT
File deleted
/programy/C/PIC_C/PICcam/873/camerus.c
File deleted
/programy/C/PIC_C/PICcam/873/camerus.lst
File deleted
/programy/C/PIC_C/PICcam/873/camerus.hex
File deleted
/programy/C/PIC_C/PICcam/876/camerus.h
File deleted
/programy/C/PIC_C/PICcam/876/camerus.PJT
File deleted
/programy/C/PIC_C/PICcam/876/camerus.c
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.LST
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.c
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.HEX
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/tester_serv/blikac.sta
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.h
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.err
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.SYM
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.tre
File deleted
/programy/C/PIC_C/mereni/tester_serv/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/tester_serv/blikac.BAK
File deleted
/programy/C/PIC_C/mereni/tester_serv/blikac.PJT
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/otmer/otmer.SYM
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.HEX
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.sta
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.h
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/otmer/16F873/otmer.err
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.SYM
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.tre
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.BAK
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.PJT
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/LCD.C
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.LST
File deleted
/programy/C/PIC_C/mereni/otmer/16F873/otmer.c
File deleted
/programy/C/PIC_C/mereni/otmer/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/otmer/shift_reg.BAK
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.c
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.HEX
File deleted
/programy/C/PIC_C/mereni/otmer/Kopie - otackomer.c
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.sta
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.h
File deleted
/programy/C/PIC_C/mereni/otmer/Kopie - otmer.c
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.err
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.tre
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.PJT
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.BAK
File deleted
/programy/C/PIC_C/mereni/otmer/otmer.LST
File deleted
/programy/C/PIC_C/mereni/teplomer/ds1820.c
File deleted
/programy/C/PIC_C/mereni/teplomer/mainhcg.BAK
File deleted
/programy/C/PIC_C/mereni/teplomer/main.c
File deleted
/programy/C/PIC_C/mereni/teplomer/main.hex
File deleted
/programy/C/PIC_C/mereni/teplomer/1wire.c
File deleted
/programy/C/PIC_C/mereni/teplomer/main.h
File deleted
/programy/C/PIC_C/mereni/teplomer/main.sta
File deleted
/programy/C/PIC_C/mereni/teplomer/main.err
File deleted
/programy/C/PIC_C/mereni/teplomer/main.sym
File deleted
/programy/C/PIC_C/mereni/teplomer/main.tre
File deleted
/programy/C/PIC_C/mereni/inertial/main.c
File deleted
/programy/C/PIC_C/mereni/inertial/main.lst
File deleted
/programy/C/PIC_C/mereni/inertial/main.hex
File deleted
/programy/C/PIC_C/mereni/inertial/main.h
File deleted
/programy/C/PIC_C/mereni/inertial/main.pjt
File deleted
/programy/C/PIC_C/mereni/mys/mys.JPG
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.h
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.sta
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.SYM
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.err
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.tre
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.BAK
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.PJT
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.LST
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.c
File deleted
/programy/C/PIC_C/mereni/mys/PIC16F88/mys.HEX
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.c
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.HEX
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/Run.BAT
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/ps2mouse.BAK
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.h
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.sta
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.err
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.tre
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.PJT
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.BAK
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/RUN.PIF
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.LST
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/main.SYM
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/prg.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/ps2mouse.c
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/ps2.BAK
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F84/ps2mouse.h
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.tre
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.BAK
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.PJT
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.LST
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.c
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.HEX
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.h
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.sta
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.SYM
File deleted
/programy/C/PIC_C/mereni/PS2mys/PIC16F88/mys.err
File deleted
/programy/C/PIC_C/mereni/gmetr/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/gmetr/gmetr.LST
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.c
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.HEX
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.h
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/gmetr/gmetr.sta
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.SYM
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.err
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.tre
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.BAK
File deleted
/programy/C/PIC_C/mereni/gmetr/gmetr.PJT
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.LST
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/piezo_cidlo/PRG.BAT
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.SYM
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/piezo_cidlo/PRG.PIF
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.c
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.HEX
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/Run.BAT
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.sta
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.h
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.err
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.tre
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/RUN.PIF
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.BAK
File deleted
/programy/C/PIC_C/mereni/piezo_cidlo/piezo.PJT
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/mereni_ultraz/main.PJT
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/main.BAK
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/RUN.PIF
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/mereni_ultraz/main.c
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/main.LST
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/main.HEX
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/main.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/mereni_ultraz/Run.BAT
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/mereni_ultraz/main.h
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/main.sta
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/main.err
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/main.SYM
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/main.tre
File deleted
/programy/C/PIC_C/mereni/mereni_ultraz/prg.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/vyskomer_drak/main.HEX
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/run.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/vyskomer_drak/main.h
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/main.sta
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/main.err
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/main.tre
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/main.PJT
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/main.BAK
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/ms5534a.c
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/main.LST
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/main.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/vyskomer_drak/main.SYM
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/prg.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/vyskomer_drak/ms5534a.BAK
File deleted
/programy/C/PIC_C/mereni/vyskomer_drak/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/vyskomer_drak/main.c
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.tre
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/prg.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/serva/PIC16F84/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/serva/PIC16F84/main.PJT
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.BAK
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.c
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.LST
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.HEX
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/serva/PIC16F84/main.h
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.sta
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.err
File deleted
/programy/C/PIC_C/mereni/serva/PIC16F84/main.SYM
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.tre
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.BAK
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.PJT
File deleted
/programy/C/PIC_C/mereni/geiger/nmea.c
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.c
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.lst
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.hex
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.h
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/geiger/geiger.sta
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.BAK
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.PJT
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.c
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.lst
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.hex
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.h
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.sta
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.err
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.sym
File deleted
/programy/C/PIC_C/mereni/geiger/bez_GPS/geiger.tre
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.err
File deleted
/programy/C/PIC_C/mereni/geiger/geiger.sym
File deleted
/programy/C/PIC_C/mereni/zavora/main.PJT
File deleted
/programy/C/PIC_C/mereni/zavora/main.BAK
File deleted
/programy/C/PIC_C/mereni/zavora/main.c
File deleted
/programy/C/PIC_C/mereni/zavora/main.LST
File deleted
/programy/C/PIC_C/mereni/zavora/main.HEX
File deleted
/programy/C/PIC_C/mereni/zavora/main.cod
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/mereni/zavora/run.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/zavora/main.h
File deleted
/programy/C/PIC_C/mereni/zavora/main.sta
File deleted
/programy/C/PIC_C/mereni/zavora/main.err
File deleted
/programy/C/PIC_C/mereni/zavora/main.SYM
File deleted
/programy/C/PIC_C/mereni/zavora/main.tre
File deleted
/programy/C/PIC_C/mereni/zavora/prg.bat
File deleted
\ No newline at end of file
/programy/C/PIC_C/mereni/zavora/vssver.scc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/test/PIC16F88/blik/blik.c
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.lst
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.hex
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/test/PIC16F88/blik/blik.h
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.sta
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.sym
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.err
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.tre
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.BAK
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/blik.PJT
File deleted
/programy/C/PIC_C/test/PIC16F88/blik/prg.bat
File deleted
/programy/C/PIC_C/test/C16F873/blik/main.c
File deleted
/programy/C/PIC_C/test/C16F873/blik/main.hex
File deleted
/programy/C/PIC_C/test/C16F873/blik/main.h
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.c
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.lst
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.hex
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/test/PIC16F84/blik/blik.h
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.sta
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.sym
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.err
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.tre
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.BAK
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/blik.PJT
File deleted
/programy/C/PIC_C/test/PIC16F84/blik/prg.bat
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.tre
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.BAK
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.PJT
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.c
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.lst
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.hex
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/test/C16F876A/blik/blik.h
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.sta
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.sym
File deleted
/programy/C/PIC_C/test/C16F876A/blik/blik.err
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.cof
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/PIC_C/test/C16F876A/LCD/main.h
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.sta
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.err
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.sym
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.tre
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.PJT
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.BAK
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/LCD.C
File deleted
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property
/programy/C/PIC_C/test/C16F876A/LCD/main.c
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.lst
File deleted
/programy/C/PIC_C/test/C16F876A/LCD/main.hex
File deleted
/programy/C/PIC/mereni/inertial/main.c
0,0 → 1,89
#include "main.h"
 
#define REV "$Rev$"
 
unsigned int32 time; // pocitadlo preteceni casovace
 
#define BUFLEN 100
 
#int_RTCC
void RTCC_isr(void) // preruseni od pretekleho casovace
{
time++;
}
 
// Includes all USB code and interrupts, as well as the CDC API
#include <usb_cdc.h>
#include <math.h>
 
float quadraticerror(float average, float buf[], int16 size) // compute average quadratic error
{
int16 i;
float err=0;
 
for(i=0; i<size; i++) err += (buf[i]-average)*(buf[i]-average); // sum quadratic errors
err = sqrt((1/(float)size)*err);
return err;
}
 
void main()
{
 
float x[BUFLEN], y[BUFLEN], z[BUFLEN];
float xavg, yavg, zavg;
int i;
port_b_pullups(FALSE);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);
setup_adc_ports(AN0_TO_AN2|VSS_VREF);
setup_adc(ADC_CLOCK_DIV_64);
 
usb_init(); // initialise USB module
 
while (TRUE)
{
while(!usb_cdc_connected());
time=0;
set_timer0(0);
printf(usb_cdc_putc,"time[s] X Xerr Y Yerr Z Zerr \n\r");
 
while(usb_cdc_connected()) // pockej nez se pripoji seriovy port PC
{
for(i=0; i <BUFLEN; i++)
{
set_adc_channel(0);
delay_us(10);
x[i]=read_adc();
xavg+=x[i];
set_adc_channel(1);
delay_us(10);
y[i]=read_adc();
yavg+=y[i];
 
set_adc_channel(2);
delay_us(10);
z[i]=read_adc();
zavg+=z[i];
}
xavg=xavg/BUFLEN;
yavg=yavg/BUFLEN;
zavg=zavg/BUFLEN;
 
// odesli namerene hodnoty
printf(usb_cdc_putc, "%7.3f %4.3f %4.3f %4.3f %4.3f %4.3f %4.3f \n\r",((time << 16) + get_timer0())/15625.0, xavg, quadraticerror(xavg,x,BUFLEN), yavg, quadraticerror(yavg,y,BUFLEN), zavg, quadraticerror(zavg,z,BUFLEN)); //konstanta k je kvuli prevodu do rozzumnych jednotek [s]
}
}
}
/programy/C/PIC/mereni/inertial/main.hex
0,0 → 1,614
:020000040000FA
:04000000B1EF0FF05D
:08000800056ED8CF06F0E0CF31
:1000100007F00001E9CF0DF0EACF08F0E1CF09F0D9
:10002000E2CF0AF0D9CF0BF0DACF0CF0F3CF14F017
:10003000F4CF15F0FACF16F000C00FF001C010F0A9
:1000400002C011F003C012F004C013F0F2AA2CEFAA
:1000500000F0F2B42FEF01F0A0AA32EF00F0A1BA45
:100060003AEF09F00FC000F010C001F011C002F02B
:1000700012C003F013C004F00DC0E9FF08C0EAFF8E
:10008000088E09C0E1FF0AC0E2FF0BC0D9FF0CC017
:10009000DAFF14C0F3FF15C0F4FF16C0FAFF0550D5
:1000A00007C0E0FF06C0D8FF1000F76ABA0FF66E6F
:1000B000000EF7220900F5501200000302FFFFFFB7
:1000C000FFFFFFFFFFFFFFFFFFFFF76ADA0FF66E8C
:1000D000000EF7220900F550120000FF02FFFFFF9B
:1000E000FFFFFFFFFFFFFFFFFFFFF76AFA0FF66E4C
:1000F000000EF7220900F5501200400008004000F1
:1001000000000000000000000000000000000000EF
:1001100000000000000000000000F76A2A0FF66EE1
:10012000010EF7220900F5501200400000004000C7
:1001300000000000000000000000000000000000BF
:1001400000000000000000000000F76A5A0FF66E81
:10015000010EF7220900F5501200090243000201C6
:100160000080320904000001020201000524001091
:1001700001042402020524060001052401000107F0
:100180000581030800FA09040100020A00000007C3
:100190000502024100010705820241000100F76AE1
:1001A000AE0FF66E010EF7220900F55012000200A4
:1001B000F76AC00FF66E010EF7220900F550120023
:1001C00012171B20FFFFFFFFF76AD80FF66E010E14
:1001D000F7220900F5501200120110010200004040
:1001E00061043300000101020001F76AFA0FF66EA4
:1001F000010EF7220900F550120004030904080358
:1002000043004300530018035300450052004900C7
:1002100041004C002000440045004D004F00F2CF4B
:100220000EF0F29EF76A380FF66E020EF722090002
:10023000F5500EBEF28E120074696D655B735D2021
:10024000205820205865727220205920205965724C
:100250007220205A20205A657272200A0D00010E69
:100260001926D8B01A2AD8B41B2AD8B41C2AF2945A
:1002700032EF00F06D92699468A402D06894FCD7C4
:1002800045EF09F0400E0401016F040E036F180ED4
:10029000026F880E006F046B040E076F580E066F16
:1002A0000001000C70A002D0EDDF7090689A4EEF54
:1002B00009F06A6A689254EF09F0070148514A034D
:1002C000F3CF01F0F4CF00F04B03F3500026495177
:1002D0004A03F3500020026E0001000C036A07017C
:1002E0000651700FE96E0F0E0320EA6EEF6A496B3C
:1002F00006C748F74B6B080E4A6F0001DEDF0701A7
:1003000001C0E9FF040E0224EA6EEF6A496B06C7DA
:1003100048F74B6B080E4A6F0001CFDF02C008F7A9
:1003200001C007F7040E07010727000E082307C7BF
:10033000E9FF040E0825EA6EEF6A0001000C010EC9
:100340000701056F05510F0807E305C706F7000110
:10035000C5DF0701052BF6D70001000C2E6A2D6AB8
:10036000250E2C6E800E2B6E2F6A306A080E316EB1
:10037000816B8091336A326A7C6B7D91000C07013E
:10038000196B195101080AE3036A1951290FE96E23
:10039000000E0320EA6EEF6A192BF3D70001DEDFAF
:1003A0001E6A010E1F6E1D6A000C689600D000D0F8
:1003B00000D0000C6A6A686A9F0E6B6E3D0E696E13
:1003C0006E6ABDDFDCDF160E706E68A602D0EDDF50
:1003D000FCD76D9857DF030E246E5AEF09F069843D
:1003E00068986D8260EF09F0689C66EF09F000C7BD
:1003F00025F0000CFF0E256E000C0601FE6B285246
:1004000042E0FE513F083FE32050000105E0020AB0
:1004100010E0010A1BE027D0036A2750F2CF00F753
:10042000F29E93DE070100BFF28EE8CFFFF60001D7
:100430001AD0036A2750F2CF00F7F29ED6DE0701EA
:1004400000BFF28EE8CFFFF600010DD0036A2750FF
:10045000F2CF00F7F29EB8DE070100BFF28EE8CFC0
:10046000FFF6000100D0272A28060601FE51FE2BC8
:10047000580F036AD8B0032AE96E040E0324EA6E0B
:10048000FFC6EFFFBCD7285204E1FE51400801E04F
:100490001D6AFEC600F70001AADF000C276A206A69
:1004A00004011B51010A000107E0030A0AE0010AE6
:1004B0000BE0220A22E042D0120E286E030E206EBC
:1004C0003FD0430E286E3CD0020E206E036A04011A
:1004D0001A51210FE96E000E0320EA6EEFCF27F0CC
:1004E000036A2750F2CFFDF6F29E00017EDE060180
:1004F000FDBFF28E286E000123D0036A04011A5159
:10050000F2CFFDF6F29E000153DE0601FDBFF28E32
:10051000276E273C01D00FD0036A2750F2CFFDF69B
:10052000F29E000112DE0601FDBFF28E286E000170
:1005300007D004D0060100015DDF0ED05BDF0CD0D8
:1005400004011F5305E128501E5D02E21EC428F07D
:10055000010E1D6E000151DF1EEF04F00601FD5378
:1005600006E1040E246E0001EADE0DD10601050E3F
:10057000246E040E0701006F980E0601FF6F010E36
:10058000FE6FFE510F08D8A0FED0FEC606F7000190
:10059000A5DE0701016B036A0601FE51F2CF05F7E4
:1005A000F29E000192DD070105BFF28EFF0871E0A7
:1005B000040E016FD8900601FE35036AF2CF05F7ED
:1005C000F29E0001AADD0900F5CF03F0070105BF87
:1005D000F28E026F03C003F7496BFEC648F74B6B00
:1005E000080E4A6F000169DE01C005F7010E070120
:1005F0000124016E000E0220036E01C0E9FF040E0B
:100600000324EA6E02C7EFFF496BFEC648F74B6B47
:10061000080E4A6F000151DE01C005F7020E070106
:100620000124016E000E0220036E01C0E9FF040EDA
:100630000324EA6E00C7ECFFED52FFC6EFFFD8902F
:100640000601FE35036AF2CF05F7F29E000165DD73
:100650000900F5CF03F0070105BFF28E0601FF2761
:10066000035007010023880E046F03B1048103B314
:100670000483496BFEC648F74B6B080E4A6F0001B6
:100680001CDE070101C0E9FF040E0224EA6E04C764
:10069000EFFF036A0601FE51F2CF05F7F29E00015B
:1006A00004DD070105BFF28EFF084EE00183496BB0
:1006B000FEC648F74B6B080E4A6F0001FEDD02C014
:1006C00006F701C005F7040E07010527000E0623F3
:1006D000020E0525016E000E0621036E01C0E9FF22
:1006E000040E0324EA6E00C7ECFFED52FFC6EFFFD5
:1006F000D8900601FE35036AF2CF05F7F29E00019D
:10070000F4DC0900F5CF03F0070105BFF28E060106
:10071000FF27035007010023496BFEC648F74B6BC8
:10072000080E4A6F0001C9DD02C006F701C005F7D7
:10073000040E07010527000E062305C7E9FF040E76
:100740000625EA6E400EEF6E0151060802E10E0E1C
:10075000016F036A0601FE51F2CF05F7F29E000118
:10076000A4DC070105BFF28E0108D8A40189036A41
:100770000601FE51700FE96E0F0E0320EA6E01C7ED
:10078000EFFFFE2BFED6000116EF04F00401195115
:1007900000010DE0010A15E0020A20E0060A2AE045
:1007A000030A31E00E0A30E0010A36E045D01FC0EE
:1007B00058F40401596B020E0701006F000117DEA7
:1007C0003DD004011A2D07D0010E1F160701006B42
:1007D00000010DDE02D000010DDE30D004011A2D23
:1007E00006D01F820701006B000101DE02D000016C
:1007F00001DE24D0020E1D6E1AC426F00701006B24
:100800000001F5DD1BD04AD61EC058F4010E0701C9
:10081000006F0001ECDD12D004011A5101080AE357
:100820001AC41EF01AC4FDF6000198D60701006B29
:100830000001DDDD000102D0DDDD00D0F3EF05F0C9
:100840001EC0FDF604011951000105E00A0A0CE082
:10085000010A31E045D00401586B596B020E0701C3
:10086000006F0001C4DD3ED00601FD5321E0010E02
:10087000FD5D036AF2CFFEF6F29E000190DC0601F8
:10088000FEBFF28E016E04011C5DD8A002D00601ED
:100890000FD0036A1C51290FE96E000E0320EA6E87
:1008A000EFCF58F4010E0701006F0001A0DD02D068
:1008B0000001A0DD17D00601FD530FE0036A04011B
:1008C0001C51290FE96E000E0320EA6E1AC4EFFFD7
:1008D0000701006B00018BDD02D000018BDD02D02F
:1008E00089DD00D0F3EF05F00601FE91FDBFFE812A
:1008F000FD9FFEA113D0036AFD51F2CFFFF6F29ED9
:10090000000155EC00F00601FFBFF28EFF0802E186
:10091000000E01D0010E016E13D012D0036AFD51FA
:10092000F2CFFFF6F29E000165EC00F00601FFBF7A
:10093000F28EFF0802E1000E01D0010E016E00D020
:10094000000154EF05F00601FE91FDBFFE81FD9F01
:10095000FEA11DD00701496BFDC648F74B6B080E81
:100960004A6F0001AADC02C000F701C0FFF6040EC6
:100970000601FF27000E07010023FFC6E9FF040E52
:1009800007010025EA6E880EEF6E11D006010701FF
:10099000496BFDC648F74B6B080E4A6F00018DDCB2
:1009A00001C0E9FF040E07010224EA6EEF6A0001AC
:1009B00063EF05F00601FE91FDBFFE81FD9FFEA1E4
:1009C0001DD00701496BFDC648F74B6B080E4A6FF7
:1009D000000173DC02C000F701C0FFF6040E06013F
:1009E000FF27000E07010023FFC6E9FF040E0701E1
:1009F0000025EA6E840EEF6E12D006010701496BE6
:100A0000FDC648F74B6B080E4A6F000156DC01C06B
:100A1000E9FF040E07010224EA6E840EEF6E000166
:100A20006BEF05F00601FE91FDBFFE81FD9FFEA16B
:100A30001BD00701496BFDC648F74B6B080E4A6F88
:100A400000013BDC02C001F701C000F7040E070102
:100A50000027000E012300C7E9FF040E0125EA6EFE
:100A6000EFCFFFF6060112D00701496BFDC648F72C
:100A70004B6B080E4A6F000120DC070101C0E9FF43
:100A8000040E0224EA6EEFCFFFF60601FFAF02D09C
:100A9000FFB502D0000E01D0010E016E000177EF0C
:100AA00005F01CC4FDF620D701522EE004011951B7
:100AB000010A000105E0020A0BE0030A11E022D05E
:100AC0001CC4FDF640D70701006B000190DC1CD070
:100AD0001CC4FDF66FD70701006B000188DC14D041
:100AE0000401586B596B1CC4FDF600019BD70152E1
:100AF00003E0010E0401586F020E0701006F0001B0
:100B000076DC02D077DC00D0F3EF05F0FE0E256E28
:100B1000000C04011C2D01D002D01C534EE11951D0
:100B200000010BE0010A0DE0210A1CE0010A1FE0B0
:100B3000030A30E0010A35E03DD0010E836FE6DFA5
:100B40003BD0040EEA6E580EE96EE26A340EE16E96
:100B5000080E016EE6CFEEFF012EFCD71EC400F793
:100B600046DC2AD0020E836F8081D0DF25D0040EB0
:100B7000EA6E580EE96EE26A2B0EE16E070E016E08
:100B8000E6CFEEFF012EFCD7070E0701006F000134
:100B90002EDC12D01AC481F00701006B000127DCA3
:100BA0000BD01AC433F01BC432F00701006B0001F4
:100BB0001EDC02D01FDC00D004010001F3EF05F0C1
:100BC0001D6A040118517F0B000107E0010A06E0CD
:100BD000030A05E0230A04E004D0D8D531D661D752
:100BE00098D708DC00D061EF08F00701496BFDC61B
:100BF00048F74B6B080E4A6F00015DEC01F00701EE
:100C000001C0E9FF040E0224EA6EEFCFFFF60601F1
:100C1000FE51020806E1FFAD02D0FE6B02D0010ECC
:100C2000FE6FFE5103081EE1840EFF6F0701496B42
:100C3000FDC648F74B6B080E4A6F00015DEC01F0F2
:100C400002C003F701C002F7040E07010227000EDD
:100C5000032302C7E9FF040E0325EA6E840EEF6E3C
:100C600009D00601FE2D03D0C80EFF6F02D0880EFA
:100C7000FF6F0701D8900601FD35036AF2CF02F736
:100C8000F29E00018DEC00F00900F5CF03F00701A2
:100C900002BFF28E006F03C001F7496BFDC648F733
:100CA0004B6B080E4A6F00015DEC01F001C002F7CA
:100CB000010E07010124016E000E0220036E01C027
:100CC000E9FF040E0324EA6E00C7EFFF01A103D081
:100CD0000601FF81070101A303D00601FF8307017D
:100CE000496BFDC648F74B6B080E4A6F00015DEC7F
:100CF00001F0070101C0E9FF040E0224EA6EFFC6FD
:100D0000EFFF0001000C036A07014751700FE96E05
:100D10000F0E0320EA6EEF521BE0496B47C748F7FE
:100D20004B6B080E4A6F00015DEC01F002C049F701
:100D300001C048F7040E07014827000E492348C7A1
:100D4000E9FF040E4925EA6EEFCF48F748AF02D01D
:100D5000000E01D0010E016E0001000C42C747F7E2
:100D6000D2DF0152D8B486D00701496B42C748F799
:100D70004B6B080E4A6F00015DEC01F002C048F7B2
:100D800001C047F7040E07014727000E4823010E54
:100D90004725016E000E4821036E01C0E9FF040ED5
:100DA0000324EA6E43C7EFFF4551020820E1496B77
:100DB00042C748F74B6B080E4A6F00015DEC01F02B
:100DC00002C048F701C047F7040E07014727000E8D
:100DD000482347C7E9FF040E4825EA6EEFCF46F7E0
:100DE00046AD02D0456B02D0010E456F1AD0455179
:100DF000040817E1496B42C748F74B6B080E4A6F6E
:100E000000015DEC01F0070101C0E9FF040E0224BE
:100E1000EA6EEFCF46F746AD03D0010E456F01D025
:100E2000456B452D03D0C80E466F02D0880E466F25
:100E300044B1468144B34683496B42C748F74B6B84
:100E4000080E4A6F00015DEC01F002C048F701C0D6
:100E500047F7040E07014727000E482347C7E9FF5D
:100E6000040E4825EA6E46C7EFFF010E016E05D05D
:100E700000D00001000E016E07010001000C83513B
:100E8000010A03E0030A15E028D0EA6A340EE96E8D
:100E9000040EE26E180EE16E080E016EE6CFEEFF54
:100EA000012EFCD70701006B0001F7EC01F0836B0A
:100EB00018D0EA6A2B0EE96E040EE26E180EE16E8F
:100EC000070E016EE6CFEEFF012EFCD7836B070104
:100ED000006B0001F7EC01F004D0836B42EC01F0F1
:100EE00000D0A6EF07F00701496BFEC648F74B6B31
:100EF000080E4A6F00015DEC01F002C000F701C06E
:100F0000FFF6010E06010124016E000E070102200A
:100F1000036E01C0E9FF040E0324EA6E036AEFCFFB
:100F200001F003C002F000019DEF07F07D817F6BAF
:100F3000020E0601FE6F0001D6D701C07EF0ADEFB4
:100F400007F00601FD5304E1000199D706D0060120
:100F5000FD51020803E10001E9D706010001000C80
:100F6000FEC66EFF0601FE5303E0040E246E02D09F
:100F7000020E246E0001C2EF07F01E6A1D6A26C031
:100F8000FEF6EED73BEF08F03AC747F7BCDE01525A
:100F90004AE00701496B3AC748F74B6B080E4A6FA6
:100FA00000015DEC01F002C043F701C042F7040EFE
:100FB00007014227000E4323020E4225016E000E58
:100FC0004321036E01C0E9FF040E0324EA6EECCF57
:100FD00003F0ED52EFCF40F703C041F741C7EAFFFE
:100FE00040C7E9FF3CC7E2FF3BC7E1FF3EC702F055
:100FF0003DC701F0015202E0022A02D0025206E08F
:10100000E6CFEEFF012EFCD7022EFAD73AC742F701
:101010003EC744F73DC743F73FC745F700019EDE93
:10102000015003D000D0000E016E000C020E07012B
:101030003A6F3C6B3C0E3B6F3E6B7CC03DF7020E43
:101040003F6F0001A1DF7CC082F07C6B000C7C5301
:1010500001E0ECDF42EF08F00601FD530EE11D2C2C
:1010600005D00001FDEC01F006D006011D5002087C
:1010700003E1000182D7060106D0FD51020803E119
:101080000001E5D706010001000C6C300601FB6F82
:10109000FB33FB331F0EFB176C524EE10401005172
:1010A0003C0B0601FC6F430E040100170001D5EC58
:1010B00001F00601FC51340822E10401046B000137
:1010C0007FD56D98253C07D00601FD6B030EFE6FA2
:1010D00000018BDD12D00601FD6B020EFE6F0001D8
:1010E00084DD2550FE0809E00701426B446B25C0F2
:1010F00043F7040E456F000131DE1CD00601FC51A0
:10110000040819E1FD6B00011CDF0601FD6B020EF6
:10111000FE6F00016ADD2550FE080CE0253C01D081
:1011200009D00701426B446B25C043F7010E456FA0
:10113000000114DE06019BD06C5004081DE1430E33
:10114000040104170001D5EC01F0FF0E256E060125
:10115000FD6B000181DF253C01D00AD00701426B05
:10116000446B25C043F7020E456F0001F7DD02D046
:1011700042EC01F07BD006016CB435D00701496B1D
:10118000FBC648F74B6B080E4A6F00015DEC01F09F
:1011900001C0FDF6060101C001F0040E0224036E39
:1011A00001C0FDF6FE6F0701496BFBC648F74B6BAC
:1011B000080E4A6F00015DEC01F001C0E9FF040E6A
:1011C00007010224EA6EEF50430B0601FEC6EAFF58
:1011D000FDC6E9FFEF6E0001D5EC01F0FBC6FDF6A0
:1011E000B0DE44D006010701496BFBC648F74B6BE4
:1011F000080E4A6F00015DEC01F002C0FEF601C06E
:10120000FDF6040E0601FD27000EFE23FDC601F0CB
:10121000040EFE25036EFDC6FDF6FE6F0701496B49
:10122000FBC648F74B6B080E4A6F00015DEC01F0FE
:1012300002C000F701C0FFF6040E0601FF27000EF2
:1012400007010023FFC6E9FF040E07010025EA6E2F
:10125000EF50430B0601FEC6EAFFFDC6E9FFEF6E45
:101260000001D5EC01F0FBC6FDF6F6DE060100013B
:101270006EEF09F0245201E13AD0685238E068A4D8
:1012800004D069A402D03AEF01F06DA201D02FD0B2
:1012900068AA04D069AA02D052EF01F068A204D073
:1012A00069A202D059EF01F068A004D069A002D071
:1012B000DAEF01F068A804D069A802D0EFEF01F0DE
:1012C00068AC04D069AC02D0F4EF01F00601FA6B0F
:1012D00068A606D069A604D00001D7D602D00601C0
:1012E00005D00601FA51FA2B0308F2E20001A19A97
:1012F00032EF00F06D6A696A080E6F6E9450300923
:101300000601946E246A186AF2BE188EF29E0001DD
:10131000BFEC01F018BEF28E8FEF09F0EBD7B5EFFE
:1013200009F0186AF2BE188EF29EBFEC01F018BEEA
:10133000F28E6D6A140E6F6E696A6D86010E246EF0
:10134000A5EF09F06DB601D0ECD7242C0BD06DBA07
:1013500009D0686A696AA08AC00EF212110E696E1D
:10136000020E246EB6EF09F0D9D7ECD7245002084C
:10137000FCE1F2EF0FF00601DD91F2BEDD81F29E9D
:1013800000017C513F0802E23F0E7C6F7C517C2BB8
:10139000036A3C0FE96E000E0320EA6EDCC6EFFF25
:1013A000F29E0601DDB1F28E186AF2BE188EF29E30
:1013B000020E0701476F0001A6DC18BEF28E015233
:1013C00007E0186AF2BE188EF29E30DE18BEF28E6A
:1013D00005EF0AF07C513F0815E2186AF2BE188E3C
:1013E000F29E020E0701476F00018DDC18BEF28EDF
:1013F000015207E0186AF2BE188EF29E17DE18BE80
:10140000F28EE8D7DBC6DCF6B6D7000C8E0E006E87
:10141000D9C601F0D8C602F0036A015209E102C040
:1014200001F0026A080E005E015202E1006A08D073
:10143000D89001BE04D0023601360006F9D7019ECD
:10144000000C800ED8A202D00601EF1B0601F46B3F
:10145000F56BEBC6F3F6EF51F31BEA51D8B4DFD0CE
:10146000F26F006EEE51D8B4E3D0F25FD8B483D0FF
:101470003EE3EFC6F8F6F88FF0C6F7F6F1C6F6F6DB
:10148000F56BD890F833F733F633F533F22FF8D7FE
:10149000F3AF03D0F481E0D0F491F291F489060E19
:1014A000EA6EED0EE96EEBD0F499F3BF0AD0F2A12B
:1014B00013D0F833F733F633F533002AD8B4C7D056
:1014C0000BD0F8BF0CD0D890F537F637F737F83790
:1014D0000006D8B4BCD0F5D7F48D6DD0F49DEBC622
:1014E000F3F6EBAF02D0F88FABD0F89FA9D0EEC6E1
:1014F000F2F6EEC600F0EA51F25FEBC6F8F6F88FAE
:10150000ECC6F7F6EDC6F6F6F56BD890F833F73380
:10151000F633F533F22FF8D7F3AF03D0F4839CD032
:10152000F493F291F48B060EEA6EF10EE96EA7D0F9
:10153000F49BF3BF0AD0F2A113D0F833F733F6339C
:10154000F533002AD8B483D00BD0F8BF0CD0D89094
:10155000F537F637F737F8370006D8B478D0F5D72F
:10156000F48F29D0F49FEFC6F3F6EFAF02D0F88FD7
:1015700067D0F89F65D0EFC6F8F6F88FF0C6F7F69B
:10158000F1C6F6F6F3AF04D0F89FF48565D0F49574
:10159000F56BF291060EEA6EED0EE96E70D0F3BFB8
:1015A0001CD0EBC6F3F6F2A106D0F833F733F633CE
:1015B000F533002A4CE0F5AF0BD0F62B09E1F72B01
:1015C00007E1F82B05E1F833F733F633002A3FE063
:1015D000F4BD84D7F4BFC6D71CD0800EF81BF8AF7B
:1015E00004D03AD0EFC6F3F60AD0EBC6F3F6F853C0
:1015F00006E1F75304E1F65302E1006A21D0F8BF97
:1016000008D0D890F537F637F737F837002EF7D7E8
:101610001ED0F3AF02D0F88F13D0F89F11D0EEC6D2
:1016200000F0EFC6F8F6F0C6F7F6F1C6F6F608D009
:10163000EAC600F0EBC6F8F6ECC6F7F6EDC6F6F62D
:10164000F8C601F0F7C602F0F6C603F034D0006A1F
:10165000016A026A036A2FD0F56BF61FF71FF81FA5
:10166000F51FF52B05E1F62B03E1F72B01E1F82B34
:10167000F4B112D7F4B354D7F4B589D7B3D7EF5038
:10168000F62705E3F72B03E1F82BD8B4F281ED52EE
:10169000EF50F72703E3F82BD8B4F281ED52EF5067
:1016A000EFBE01D0800AF827D8B0F281F4B9FCD699
:1016B000F4BB3ED774D70001000C0601EA51D8B440
:1016C000A5D0F66FEE51D8B4A1D0F65F05E37F0E3A
:1016D000F627D8B09BD006D0810EF65FD8A096D062
:1016E000D8B494D0F6C600F0016A026A036AF56BBA
:1016F000EBC6F4F6F48FECC6F3F6EDC6F2F6190E6F
:10170000F66FF151F25F0DE2010EF35F0AE2F45F52
:1017100008E2F55F06E2F52BF42BF32BF151F227EB
:1017200028D0F051F35F12E2010EF45F0FE2F55F93
:101730000DE2F52BF42BF051F327F151F22719E3C9
:10174000F32B17E1F42B15E1F52B13D0EF518009A2
:10175000F45F0EE2010EF55F0BE2F52BEF5180090D
:10176000F427F051F327E9E3F42BE7E1F52BE5D774
:101770000380F62F01D00BD0D890F237F337F4372F
:10178000F537D890033602360136F737BAD7F7A1C6
:1017900006D0D890013202320332F73302D000066D
:1017A00035E0F7BF1ED0D890F237F337F437F5376E
:1017B000F151F25F07E2010EF35F04E2F45F02E22F
:1017C000F55F1AE3F051F35F05E2010EF45F02E208
:1017D000F55F12E3EF518009F45F03E2010EF55F5C
:1017E0000BE3032A09E1022A07E1012A05E1002AA5
:1017F0000DE0013202320332EBC6F6F6EF51F61B72
:10180000F6AF02D0018E06D0019E04D0006A016AB4
:10181000026A036A0001000CB60E006E036A026AD7
:10182000016A0601C251C311C411C51102E1006A67
:101830000DD0D89001BE09D0C237C337C437C537E1
:10184000033602360136002EF4D7019E0001E9EF7F
:1018500011F00601E451D8B471D0006EE851D8B44B
:101860006DD0002604E3810E002668E204D07F0ECE
:10187000005E64E363E0E5C6ECF6E951EC1BE58F3E
:10188000E98FE751EB03F4CFEEF6E651EA03F4CF2C
:1018900003F0F3CFEDF6EB03F350EE27F450ED2316
:1018A000000E0322E751EA03F350EE27F450ED2334
:1018B000000E026A03220222E551EB03F350ED27EA
:1018C000F4500322000E0222E551EA03F3500326EE
:1018D000F4500222000E016A0122E751E903F3509D
:1018E000ED27F4500322000E02220122E651E90303
:1018F000F3500326F4500222000E0122E551E903C1
:10190000F3500226F4500122002A01BE05D0ED3723
:101910000336023601360006000EEDAF0AD0032A68
:1019200002220122015005E1025003E1035001E1CE
:10193000002AECBF018EECAF019E04D0006A016A60
:10194000026A036A0001000CEBC6F2F60601EF51D1
:10195000F21BF2AF05D0D894D890EBBFD8802FD02F
:10196000EBC6F2F6EEC6F3F6EA51F35F06E0F2AF2D
:1019700026D0D850010AD86E22D0EFC6F3F6EB512C
:10198000F35F06E0F2AF1BD0D850010AD86E17D033
:10199000F0C6F3F6EC51F35F06E0F2AF10D0D8508A
:1019A000010AD86E0CD0F1C6F3F6ED51F35F06E0F4
:1019B000F2AF05D0D850010AD86E01D0D8900001FE
:1019C000000CDFC6EDF6DEC6ECF6DDC6EBF6DCC6D7
:1019D000EAF60601F16BF06BEF6BEE6B0001B4DF22
:1019E00001E205E1006A016A026A036A78D0DFC693
:1019F000E3F6DEC6E2F6DDC6E1F6DCC6E0F6060E8C
:101A00000601E96FE00EE86FE8C6E9FFE9C6EAFF04
:101A1000EF50ED6BEC6F7F0EEC27000EED23D890AE
:101A2000ED31EC31E9C6EAFFE8C6E9FFEF6EE3C647
:101A3000E7F6E2C6E6F6E1C6E5F6E0C6E4F6DFC69E
:101A4000EDF6DEC6ECF6DDC6EBF6DCC6EAF6E3C67E
:101A5000F1F6E2C6F0F6E1C6EFF6E0C6EEF60001FA
:101A60002CDED892E3C6EDF6E2C6ECF6E1C6EBF664
:101A7000E0C6EAF603C0F1F602C0F0F601C0EFF6E8
:101A800000C0EEF6DEDC03C0E3F602C0E2F601C001
:101A9000E1F600C0E0F60601E8C6E9FFE9C6EAFFA4
:101AA000EF06E7C6EDF6E6C6ECF6E5C6EBF6E4C6ED
:101AB000EAF6E3C6F1F6E2C6F0F6E1C6EFF6E0C6F6
:101AC000EEF6000141DFD8B402D00601B0D7E4C67B
:101AD00000F0E5C601F0E6C602F0E7C603F065EFE8
:101AE0000EF00601D46BD56BD66BD76BD36BD26B74
:101AF000D351D15DD8A0A8D004E1D051D25DD8B0E7
:101B0000A3D0D235026ED335036E02360336FC0EF7
:101B100002160250CE25E96ECF510320EA6EEFCFB8
:101B2000D8F6ECCFD9F6ECCFDAF6ECCFDBF6EACF8D
:101B3000DDF6E9CFDCF6D882DBC6EDF6DAC6ECF6E8
:101B4000D9C6EBF6D8C6EAF6CDC6F1F6CCC6F0F6A5
:101B5000CBC6EFF6CAC6EEF6000173DCDDC6EAFFBF
:101B6000DCC6E9FF00C0D8F601C0D9F602C0DAF63B
:101B700003C0DBF60601D235026ED335036E0236A2
:101B80000336FC0E02160250CE25E96ECF5103201B
:101B9000EA6EEFCFDEF6ECCFDFF6ECCFE0F6ECCF7F
:101BA000E1F6EACFE3F6E9CFE2F6D882E1C6EDF658
:101BB000E0C6ECF6DFC6EBF6DEC6EAF6CDC6F1F619
:101BC000CCC6F0F6CBC6EFF6CAC6EEF6000139DC9D
:101BD000E3C6EAFFE2C6E9FFDBC6E7F6DAC6E6F6E9
:101BE000D9C6E5F6D8C6E4F603C0EBF602C0EAF6BD
:101BF00001C0E9F600C0E8F62CDEEACFD9F6E9CF5D
:101C0000D8F6D892D7C6EDF6D6C6ECF6D5C6EBF622
:101C1000D4C6EAF603C0F1F602C0F0F601C0EFF652
:101C200000C0EEF60EDCD9C6EAFFD8C6E9FF03C055
:101C3000D7F602C0D6F601C0D5F600C0D4F606012C
:101C4000D22BD8B4D32B54D7D1C6D9F6D0C6D8F618
:101C5000000106EC0AF00601ED6BEC6BEB6B7F0EFE
:101C6000EA6F03C0F1F602C0F0F601C0EFF600C063
:101C7000EEF6000122DD00C0D8F601C0D9F602C0A0
:101C8000DAF603C0DBF603C0E7F602C0E6F601C0F1
:101C9000E5F600C0E4F6D7C6EBF6D6C6EAF6D5C63A
:101CA000E9F6D4C6E8F6D5DD00C0D8F601C0D9F60D
:101CB00002C0DAF603C0DBF603C0DFF602C0DEF6D0
:101CC00001C0DDF600C0DCF67CD603C0D7F602C04A
:101CD000D6F601C0D5F600C0D4F6D4C600F0D5C6FD
:101CE00001F0D6C602F0D7C603F0000C0601DB51A6
:101CF000B608DB6F036ADCC6DFF6DC8FD890DC3316
:101D0000DD33DE330332023201320032DB2FF6D70D
:101D1000DFAF0BD0001E011E021E031E002AD8B426
:101D2000012AD8B4022AD8B4032A000103EF0FF025
:101D3000006A016A026A036A0601E36BE46BE56B01
:101D4000E66BE251E111E011DF112CE0200EE76FAC
:101D5000D890DB37DC37DD37DE37E337E437E5377C
:101D6000E637E251E65D08E1E151E55D05E1E0516C
:101D7000E45D02E1DF51E35D0FE3DF51E35FE0513A
:101D8000D8A0E03DE45FE151D8A0E13DE55FE2513C
:101D9000D8A0E23DE65FD880003601360236033631
:101DA000E72FD6D7060EEA6EE30EE96E0001000CAF
:101DB000E9500601D36FD251D56F1BE0D1C6E7F6CB
:101DC000D0C6E6F6CFC6E5F6CEC6E4F6EB6BEA6B18
:101DD000200EE96F820EE86F00013BDD03C0D1F6F3
:101DE00002C0D0F601C0CFF600C0CEF60601D52F56
:101DF000E5D7D1C6DEF6D0C6DDF6CFC6DCF6CEC658
:101E0000DBF6000173D703C0D1F602C0D0F601C0E3
:101E1000CFF600C0CEF60601D1AF0DD0D307D38BDD
:101E2000CE1FCF1FD01FD11FCE2BD8B4CF2BD8B4ED
:101E3000D02BD8B4D12B3B0EDA6F9A0ED96FCA0EC5
:101E4000D86FD76B0A0ED56FD251D8B4D32BD1C669
:101E5000DEF6D0C6DDF6CFC6DCF6CEC6DBF6DAC6D9
:101E6000E2F6D9C6E1F6D8C6E0F6D7C6DFF600013D
:101E70005FDF0150EFCFCEF6ECCFCFF6ECCFD0F650
:101E8000ECCFD1F6005213E10601D229D55DD8A4DA
:101E900002D000010CD0D3510DE00F0BD55D01E055
:101EA00044E2D3BF42D0D3BD05D0200E37D0200EA0
:101EB0000601D317D3AB0FD0D39BD251D8A4D307ED
:101EC0000050D36F2D0EDB6F0001EAEC09F0060124
:101ED000D351006ED36BD251D55D0DE10050D36F5D
:101EE0002E0EDB6F0001EAEC09F00601D351006E03
:101EF000200ED317000E300ED3AB10D0D39BD2518F
:101F0000D8A4D3070050D36F2D0EDB6F0001EAEC8D
:101F100009F00601D351006ED36B300E002600C0CD
:101F2000DBF60001EAEC09F00601DAC6DEF6D9C6F6
:101F3000DDF6D8C6DCF6D7C6DBF6E26BE16BE06B0C
:101F40000A0EDF6F0001F4DE03C0DAF602C0D9F634
:101F500001C0D8F600C0D7F60601D52F78D700010A
:101F6000000CF86AD09E088EEA6AE96AC150C00B7C
:101F70000F09C16E070EB46E216A040E226E0C0E9C
:101F8000236E246A286A7C6B836BF18EB098C69AA4
:101F9000949E93809392010EC66E000EC76ED190F0
:101FA000870ED56ECD6A000ECA6E000ECB6EB16A7A
:101FB000070EB46E9250926E130E006E002EFED776
:101FC00000D0B450A19CB56AF28AC00EF212C15082
:101FD000C00B1C09C16EC090C082C084C08EC2807C
:101FE000B4EF09F080A1FED71C6A1B6A1A6A196A4D
:101FF000D76AD66A0301B16BB15100010FEC01F051
:102000000301B12B006EE8CFDBF60001EAEC09F02A
:10201000250E0301B15DF0E1000180A1E0D20301D2
:10202000B06BB0516308D8A06BD1000E016EC250E6
:10203000C30B0110C26E130E006E002EFED700D02F
:10204000186AF2BE188EF29E0701496BB0C348F7BA
:102050004B6B040E4A6F00015DEC01F018BEF28E6E
:1020600002C003F00150840FE96E000E0220EA6EF8
:10207000C282C2B2FED7C4CFD9F6C3CFD8F6000110
:1020800006EC0AF000C0EFFF01C0ECFF02C0ECFF5D
:1020900003C0ECFF186AF2BE188EF29E0701496B6E
:1020A000B0C348F74B6B040E4A6F00015DEC01F0C2
:1020B00018BEF28E02C003F00150840FE96E000ECC
:1020C0000220EA6EEFCF00F0ECCF01F0ECCF02F08F
:1020D000ECCF03F0EACFB2F3E9CFB1F3D892A7C3C4
:1020E000EDF6A6C3ECF6A5C3EBF6A4C3EAF603C06F
:1020F000F1F602C0F0F601C0EFF600C0EEF621ECFA
:102100000AF0B2C3EAFFB1C3E9FF03C0A7F302C0FC
:10211000A6F301C0A5F300C0A4F3040E016EC250E3
:10212000C30B0110C26E130E006E002EFED700D03E
:10213000186AF2BE188EF29E0701496BB0C348F7C9
:102140004B6B040E4A6F00015DEC01F018BEF28E7D
:1021500002C003F00150140FE96E020E0220EA6E75
:10216000C282C2B2FED7C4CFD9F6C3CFD8F600011F
:1021700006EC0AF000C0EFFF01C0ECFF02C0ECFF6C
:1021800003C0ECFF186AF2BE188EF29E0701496B7D
:10219000B0C348F74B6B040E4A6F00015DEC01F0D1
:1021A00018BEF28E02C003F00150140FE96E020E49
:1021B0000220EA6EEFCF00F0ECCF01F0ECCF02F09E
:1021C000ECCF03F0EACFB2F3E9CFB1F3D892ABC3CF
:1021D000EDF6AAC3ECF6A9C3EBF6A8C3EAF603C072
:1021E000F1F602C0F0F601C0EFF600C0EEF621EC09
:1021F0000AF0B2C3EAFFB1C3E9FF03C0ABF302C008
:10220000AAF301C0A9F300C0A8F3080E016EC250E2
:10221000C30B0110C26E130E006E002EFED700D04D
:10222000186AF2BE188EF29E0701496BB0C348F7D8
:102230004B6B040E4A6F00015DEC01F018BEF28E8C
:1022400002C003F00150200FE96E050E0220EA6E75
:10225000C282C2B2FED7C4CFD9F6C3CFD8F600012E
:1022600006EC0AF000C0EFFF01C0ECFF02C0ECFF7B
:1022700003C0ECFF186AF2BE188EF29E0701496B8C
:10228000B0C348F74B6B040E4A6F00015DEC01F0E0
:1022900018BEF28E02C003F00150200FE96E050E49
:1022A0000220EA6EEFCF00F0ECCF01F0ECCF02F0AD
:1022B000ECCF03F0EACFB2F3E9CFB1F3D892AFC3DA
:1022C000EDF6AEC3ECF6ADC3EBF6ACC3EAF603C075
:1022D000F1F602C0F0F601C0EFF600C0EEF621EC18
:1022E0000AF0B2C3EAFFB1C3E9FF03C0AFF302C013
:1022F000AEF301C0ADF300C0ACF30301B02B91D637
:10230000A7C3EDF6A6C3ECF6A5C3EBF6A4C3EAF6A5
:102310000601F16BF06B480EEF6F850EEE6F00015A
:102320005DEC0BF003C0A7F302C0A6F301C0A5F358
:1023300000C0A4F3ABC3EDF6AAC3ECF6A9C3EBF659
:10234000A8C3EAF60601F16BF06B480EEF6F850E3D
:10235000EE6F00015DEC0BF003C0ABF302C0AAF31B
:1023600001C0A9F300C0A8F3AFC3EDF6AEC3ECF60D
:10237000ADC3EBF6ACC3EAF60601F16BF06B480EA9
:10238000EF6F850EEE6F00015DEC0BF003C0AFF355
:1023900002C0AEF301C0ADF300C0ACF31AC0B5F398
:1023A00019C0B4F30301B26BB36BD650D7CF03F0AF
:1023B000B227D750B323000EB423B523B5C3C5F657
:1023C000B4C3C4F6B3C3C3F6B2C3C2F600010CEF84
:1023D0000CF003C0EDF602C0ECF601C0EBF600C055
:1023E000EAF60601F16B240EF06F740EEF6F8C0E9F
:1023F000EE6F00015DEC0BF000C0B2F301C0B3F36F
:1024000002C0B4F303C0B5F3A7C3CDF6A6C3CCF6A0
:10241000A5C3CBF6A4C3CAF60601CF6B840ECE6F5C
:10242000D16B640ED06F000171EC0DF000C0B6F3FB
:1024300001C0B7F302C0B8F303C0B9F3ABC3CDF624
:10244000AAC3CCF6A9C3CBF6A8C3CAF6020E0601EE
:10245000CF6F140ECE6FD16B640ED06F000171EC94
:102460000DF000C0BAF301C0BBF302C0BCF303C05F
:10247000BDF3AFC3CDF6AEC3CCF6ADC3CBF6ACC3A4
:10248000CAF6050E0601CF6F200ECE6FD16B640E1B
:10249000D06F000171EC0DF000C0BEF301C0BFF3BE
:1024A00002C0C0F303C0C1F3060EE96EB5C3D1F696
:1024B000B4C3D0F6B3C3CFF6B2C3CEF6030E060153
:1024C000D26F000175DC200E0601DB6F0001EAEC23
:1024D00009F0030EE96EA7C3D1F6A6C3D0F6A5C3D3
:1024E000CFF6A4C3CEF60601D26F000161DC200E48
:1024F0000601DB6F0001EAEC09F0030EE96EB9C3D7
:10250000D1F6B8C3D0F6B7C3CFF6B6C3CEF6060140
:10251000D26F00014DDC200E0601DB6F0001EAECFA
:1025200009F0030EE96EABC3D1F6AAC3D0F6A9C376
:10253000CFF6A8C3CEF60601D26F000139DC200E1B
:102540000601DB6F0001EAEC09F0030EE96EBDC382
:10255000D1F6BCC3D0F6BBC3CFF6BAC3CEF60601E4
:10256000D26F000125DC200E0601DB6F0001EAECD2
:1025700009F0030EE96EAFC3D1F6AEC3D0F6ADC31A
:10258000CFF6ACC3CEF60601D26F000111DC200EEF
:102590000601DB6F0001EAEC09F0030EE96EC1C32E
:1025A000D1F6C0C3D0F6BFC3CFF6BEC3CEF6060188
:1025B000D26F0001D8EC0EF0200E0601DB6F000197
:1025C000EAEC09F00A0E0601DB6F0001EAEC09F003
:1025D0000D0E0601DB6F0001EAEC09F01ED502D5F5
:0225E0000300F6
:020000040030CA
:0E0000003CCE390E0087A1000FC00FE00F406C
:00000001FF
;PIC18F4550
;CRC=66E2 CREATED="15-V-10 23:52"
/programy/C/PIC/mereni/inertial/main.lst
0,0 → 1,11713
CCS PCH C Compiler, Version 4.090, 47914 15-V-10 23:52
 
Filename: D:\svnKaklik\programy\C\PIC_C\mereni\inertial\main.lst
 
ROM used: 9694 bytes (30%)
Largest free fragment is 23070
RAM used: 1650 (81%) at main() level
1869 (91%) worst case
Stack: 17 worst case (8 in main + 9 for interrupts)
 
*
0000: GOTO 1F62
*
0008: MOVWF 05
000A: MOVFF FD8,06
000E: MOVFF FE0,07
0012: MOVLB 0
0014: MOVFF FE9,0D
0018: MOVFF FEA,08
001C: MOVFF FE1,09
0020: MOVFF FE2,0A
0024: MOVFF FD9,0B
0028: MOVFF FDA,0C
002C: MOVFF FF3,14
0030: MOVFF FF4,15
0034: MOVFF FFA,16
0038: MOVFF 00,0F
003C: MOVFF 01,10
0040: MOVFF 02,11
0044: MOVFF 03,12
0048: MOVFF 04,13
004C: BTFSS FF2.5
004E: GOTO 0058
0052: BTFSC FF2.2
0054: GOTO 025E
0058: BTFSS FA0.5
005A: GOTO 0064
005E: BTFSC FA1.5
0060: GOTO 1274
0064: MOVFF 0F,00
0068: MOVFF 10,01
006C: MOVFF 11,02
0070: MOVFF 12,03
0074: MOVFF 13,04
0078: MOVFF 0D,FE9
007C: MOVFF 08,FEA
0080: BSF 08.7
0082: MOVFF 09,FE1
0086: MOVFF 0A,FE2
008A: MOVFF 0B,FD9
008E: MOVFF 0C,FDA
0092: MOVFF 14,FF3
0096: MOVFF 15,FF4
009A: MOVFF 16,FFA
009E: MOVF 05,W
00A0: MOVFF 07,FE0
00A4: MOVFF 06,FD8
00A8: RETFIE 0
.................... #include "main.h"
.................... #include <18F4550.h>
.................... //////// Standard Header file for the PIC18F4550 device ////////////////
.................... #device PIC18F4550
.................... #list
....................
.................... #device adc=10
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
.................... #FUSES HSPLL //Crystal/Resonator with PLL enabled
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES BORV20 //Brownout reset at 2.0V
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES NOCPD //No EE protection
.................... #FUSES STVREN //Stack full/underflow will cause reset
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES NOWRTD //Data EEPROM not write protected
.................... #FUSES IESO //Internal External Switch Over mode enabled
.................... #FUSES FCMEN //Fail-safe clock monitor enabled
.................... #FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
.................... #FUSES NOWRTC //configuration not registers write protected
.................... #FUSES NOWRTB //Boot block not write protected
.................... #FUSES NOEBTR //Memory not protected from table reads
.................... #FUSES NOEBTRB //Boot block not protected from table reads
.................... #FUSES NOCPB //No Boot Block code protection
.................... #FUSES MCLR //Master Clear pin enabled
.................... #FUSES LPT1OSC //Timer1 configured for low-power operation
.................... #FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
.................... #FUSES PLL5 //Divide By 5(20MHz oscillator input)
.................... #FUSES CPUDIV4 //System Clock by 4
.................... #FUSES USBDIV //USB clock source comes from PLL divide by 2
.................... #FUSES VREGEN //USB voltage regulator enabled
.................... #FUSES ICPRT //ICPRT enabled
....................
.................... #use delay(clock=24000000)
....................
....................
....................
.................... #define REV "$Rev$"
....................
.................... unsigned int32 time; // pocitadlo preteceni casovace
....................
.................... #define BUFLEN 100
....................
.................... #int_RTCC
.................... void RTCC_isr(void) // preruseni od pretekleho casovace
.................... {
.................... time++;
*
025E: MOVLW 01
0260: ADDWF 19,F
0262: BTFSC FD8.0
0264: INCF 1A,F
0266: BTFSC FD8.2
0268: INCF 1B,F
026A: BTFSC FD8.2
026C: INCF 1C,F
.................... }
....................
.................... // Includes all USB code and interrupts, as well as the CDC API
.................... #include <usb_cdc.h>
.................... /////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// usb_cdc.h ////
.................... //// ////
.................... //// Library for adding a virtual COM port on your PC over USB using ////
.................... //// the standard Communication Device Class (CDC) specification. ////
.................... //// Including this file in your code will add all USB code, ////
.................... //// interrupts, descriptors and handlers required. No other ////
.................... //// modifications need to be made. ////
.................... //// ////
.................... //// This library creates a virtual RS232 link between the PC and ////
.................... //// the PIC, therefore the library provided will be familiar to ////
.................... //// anyone with standard UART stream I/O: ////
.................... //// ////
.................... //// usb_cdc_kbhit() - Returns TRUE if there is one or more ////
.................... //// character received and waiting in the receive buffer. ////
.................... //// ////
.................... //// usb_cdc_getc() - Gets a character from the receive buffer. If ////
.................... //// there is no data in the receive buffer it will wait until ////
.................... //// there is data in the receive buffer. If you do not want ////
.................... //// to wait in an infinit loop, use usb_cdc_kbhit() first to ////
.................... //// check if there is data before calling usb_cdc_getc(). ////
.................... //// ////
.................... //// usb_cdc_putc(char c) - Puts a character into the transmit ////
.................... //// buffer. If the transmit buffer is full it will wait until ////
.................... //// the transmit buffer is not full before putting the char ////
.................... //// into the transmit buffer. The transmit buffer is read by ////
.................... //// the PC very quickly, and therefore the buffer should only ////
.................... //// be full for a few milli-seconds. If you are concerned ////
.................... //// and don't want to be stuck in a long or infinite loop, ////
.................... //// use usb_cdc_putready() to see if there is space in the ////
.................... //// transmit buffer before putting data into the transmit ////
.................... //// buffer. ////
.................... //// ////
.................... //// usb_cdc_putready() - Returns TRUE if there is room left in the ////
.................... //// transmit buffer for another character. ////
.................... //// ////
.................... //// usb_cdc_connected() - Returns TRUE if we received a ////
.................... //// Set_Line_Coding. On most serial terminal programs (such ////
.................... //// as Hyperterminal), they will send a Set_Line_Coding ////
.................... //// message when the program starts and it opens the virtual ////
.................... //// COM port. This is a simple way to determine if the PC ////
.................... //// is ready to display data on a serial terminal program, ////
.................... //// but is not garaunteed to work all the time or on other ////
.................... //// terminal programs. ////
.................... //// ////
.................... //// usb_cdc_putc_fast(char c) - Similar to usb_cdc_putc(), except ////
.................... //// if the transmit buffer is full it will skip the char. ////
.................... //// ////
.................... //// usb_cdc_line_coding - A structure used for Set_Line_Coding and ////
.................... //// Get_Line_Coding. Most of the time you can ignore this. ////
.................... //// ////
.................... //// usb_cdc_break - If the PC has sent a break command, this will ////
.................... //// hold the break time (in milli-seconds). If the PC sends ////
.................... //// a value of 0xFFFF the device is supposed to hold the ////
.................... //// break until it sends a value of 0 ////
.................... //// ////
.................... //// usb_cdc_carrier - Where Set_Control_Line_State value is stored. ////
.................... //// Of most relevance is the field dte_present, which is the ////
.................... //// DTR setting. ////
.................... //// ////
.................... //// The following functions are also provided, and are ports of the ////
.................... //// I/O functions in input.c. See input.c and the CCS manual for ////
.................... //// documentation: ////
.................... //// get_float_usb() - Read a float number from the user ////
.................... //// get_long_usb() - Read a long number from the user ////
.................... //// get_int_usb() - Read an integer number from the user ////
.................... //// get_string_usb(char *s, int max) - Read a string from the user. ////
.................... //// gethex_usb() - Read a byte, in HEX, from the user ////
.................... //// gethex1_usb() - Read a HEX character ////
.................... //// ////
.................... //// This driver will load all the rest of the USB code, and a set ////
.................... //// of descriptors that will properly describe a CDC device for a ////
.................... //// virtual COM port (usb_desc_cdc.h) ////
.................... //// ////
.................... //// An .INF file is provided (cdc_NTXP.inf) that will load the ////
.................... //// standard CDC drivers for a virtual COM port in Windows ////
.................... //// NT/2000/XP and above. ////
.................... //// ////
.................... /////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// VERSION HISTORY ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... //// Nov 26th, 2007: ////
.................... //// usb_cdc_put_buffer_free() should be more stable. ////
.................... //// Fixed a hang-up that would happen if you sent ////
.................... //// exactly 64 bytes. ////
.................... //// ////
.................... //// Nov 6th, 2007: ////
.................... //// Compatabible with latest pic18_usb.h, which ////
.................... //// reduces RAM footprint of USB driver. ////
.................... //// This driver now fits on 18F4450/2450 PICs. ////
.................... //// ////
.................... //// October 27th, 2005: Changed the way incoming packets are ////
.................... //// handled in that CDC driver will not flush ////
.................... //// endpoint until user has handled all data. This ////
.................... //// will prevent overflows as the USB will NAK ////
.................... //// incoming packets until it is ready to receive ////
.................... //// more. ////
.................... //// When using 18F4550 family, the RX buffer is ////
.................... //// mapped directly to the endpoint buffer - this ////
.................... //// saves a chunk of RAM. ////
.................... //// When using the 18F4550 family, you can increase ////
.................... //// the TX and RX size over 64 bytes. ////
.................... //// No longer send 0len packets in the TBE interrupt. ////
.................... //// Hopefully fixed bugs that caused random crashes ////
.................... //// if you tried sending more than 64 bytes. ////
.................... //// ////
.................... //// July 6th, 2005: Global interrupts disabled when writing to TX ////
.................... //// buffer. ////
.................... //// ////
.................... //// July 1st, 2005: Initial Release. ////
.................... //// ////
.................... /////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2005 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... /////////////////////////////////////////////////////////////////////////
....................
....................
.................... //api for the user:
.................... #define usb_cdc_kbhit() (usb_cdc_get_buffer_status.got)
.................... #define usb_cdc_putready() (usb_cdc_put_buffer_nextin<USB_CDC_DATA_IN_SIZE)
.................... #define usb_cdc_connected() (usb_cdc_got_set_line_coding)
026E: BCF FF2.2
0270: GOTO 0064
.................... void usb_cdc_putc_fast(char c);
.................... char usb_cdc_getc(void);
.................... void usb_cdc_putc(char c);
....................
.................... //input.c ported to use CDC:
.................... float get_float_usb();
.................... signed long get_long_usb();
.................... signed int get_int_usb();
.................... void get_string_usb(char* s, unsigned int max);
.................... BYTE gethex_usb();
.................... BYTE gethex1_usb();
....................
.................... //functions automatically called by USB handler code
.................... void usb_isr_tkn_cdc(void);
.................... void usb_cdc_init(void);
.................... void usb_isr_tok_out_cdc_control_dne(void);
.................... void usb_isr_tok_in_cdc_data_dne(void);
.................... void usb_isr_tok_out_cdc_data_dne(void);
....................
.................... void usb_cdc_flush_out_buffer(void);
....................
.................... /////////////////////////////////////////////////////////////////////////////
.................... //
.................... // Include the CCS USB Libraries. See the comments at the top of these
.................... // files for more information
.................... //
.................... /////////////////////////////////////////////////////////////////////////////
.................... #ifndef __USB_PIC_PERIF__
.................... #define __USB_PIC_PERIF__ 1
.................... #endif
....................
.................... #if __USB_PIC_PERIF__
.................... #if defined(__PCH__)
.................... #include <pic18_usb.h> //Microchip 18Fxx5x hardware layer for usb.c
.................... /////////////////////////////////////////////////////////////////////////
.................... //// pic18_usb.h ////
.................... //// ////
.................... //// Hardware layer for CCS's USB library. This hardware layer ////
.................... //// supports the USB peripheral on the PIC18 family chips. Current ////
.................... //// supported families are: ////
.................... //// PIC18F2455/2550/4455/4550 ////
.................... //// PIC18F2450/4450 ////
.................... //// PIC18F2458/2553/4458/4553 ////
.................... //// PIC18F13K50/14K50 ////
.................... //// PIC18F65J50/66J50/66J55/67J50/85J50/86J50/86J55/87J50 ////
.................... //// ////
.................... //// This file is part of CCS's PIC USB driver code. See USB.H ////
.................... //// for more documentation and a list of examples. ////
.................... //// ////
.................... //// See the section labeled EXTRA USER FUNCTIONS for functions ////
.................... //// that are specific to only this HW peripheral that you may ////
.................... //// find useful to use in your application. ////
.................... //// ////
.................... //// *********** NOTE ABOUT 18F2450/4450 LIMITATIONS ********** ////
.................... //// Due to the limited USB RAM of this family, a limitation of ////
.................... //// this driver is that there are only 3 endpoints (0, 1 and 2). ////
.................... //// The HW actually supports more endpoints, but to simplify ////
.................... //// driver development this driver will only support the first 3 ////
.................... //// so there is an easier memory block to work with. ////
.................... //// ////
.................... //// USB_MAX_EP0_PACKET_LENGTH will also be set to 8 regardless ////
.................... //// of USB speed, to save RAM. ////
.................... //// ////
.................... //// ************** NOTE ABOUT HW REQUIREMENTS **************** ////
.................... //// If you are not using internal pullups, you will need to put ////
.................... //// an internal pullup resistor on D+ or D+ depending on if you ////
.................... //// want to use slow speed or full speed. This code configures ////
.................... //// the device to use internal pullups, see usb_init() if you ////
.................... //// want to change that. ////
.................... //// ////
.................... //// You need approximately 470nF cap on Vusb, even if you are ////
.................... //// using the internal 3.3V USB regulator. ////
.................... //// ////
.................... //// To run at full speed, you must use the oscillator ////
.................... //// configuration (PLLx) to set the PLL divide to 4MHz. You can ////
.................... //// configure the MCU clock to any speed (up to 48MHz) but the ////
.................... //// PLL must run at 4Mhz to provide the USB peripheral with a ////
.................... //// 96MHz clock. See the datasheet for details. ////
.................... //// ////
.................... //// To run at slow speed you must configure your MCU to run at ////
.................... //// 24Mhz. See the datasheet for details. ////
.................... //// ////
.................... //// **************** NOTE ABOUT INTERRUPTS ****************** ////
.................... //// This driver uses INT_USB. It requires INT_USB to interrupt the ////
.................... //// PIC when an event has happened on the USB Bus. Therfore ////
.................... //// this code enables interrupts. A user modification can be made ////
.................... //// to poll the USB interrupt flag instead of relying on an ////
.................... //// interrupt. ////
.................... //// ////
.................... /////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// Version History: ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// 18F14K50 family added. ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... //// Nov 3rd, 2008: ////
.................... //// * 4553 family added. ////
.................... //// ////
.................... //// Dec 18, 2007: ////
.................... //// * usb_kbhit() moved to device driver. ////
.................... //// * USB Token handler changed to workaround a flaw in the USB ////
.................... //// peripheral to prevent the USB peripheral from ////
.................... //// inadvertantly STALLing the endpoint. Happened most often ////
.................... //// in bulk demo applications, especially CDC. ////
.................... //// ////
.................... //// 11-6-07: Fixed a bug where usb_data_buffer[] was reserving ////
.................... //// too much RAM. ////
.................... //// USB_MAX_EP0_PACKET_LENGTH value can be overwritten. ////
.................... //// For the 18F4450/2450 family this should be 8 ////
.................... //// because of limited RAM. Reducing this value ////
.................... //// frees RAM for application. ////
.................... //// Based upon which endpoints have been configured for ////
.................... //// use, will free up unused USB data RAM for ////
.................... //// application dynamically. This should free up ////
.................... //// at least 128 bytes of RAM. ////
.................... //// CDC now fits on a 18F4450/2450 ////
.................... //// ////
.................... //// 09-19-07: Fixed problems with 18F4450 family. ////
.................... //// ////
.................... //// 07-17-07: Added 18F4450,2450 support ////
.................... //// ////
.................... //// 07-13-07: Added 87J50 family support ////
.................... //// ////
.................... //// 11-01-05: usb_detach(), usb_attach() and usb_init_cs() ////
.................... //// changed for the better. ////
.................... //// ////
.................... //// 10-28-05: Added usb_rx_packet_size() ////
.................... //// ////
.................... //// 07-13-05: usb_put_packet() changed for 16bit packet sizes ////
.................... //// usb_flush_in() changed for 16bit packet sizes ////
.................... //// usb_get_packet() changed for 16bit packet sizes ////
.................... //// usb_flush_out() changed for 16bit packet sizes ////
.................... //// usb_set_configured() changed for 16bit packet sizes ////
.................... //// ////
.................... //// 06-30-05: usb_tbe() added ////
.................... //// The way endpoint 0 DTS is set has been changed. ////
.................... //// ////
.................... //// 06-20-05: Initial Release ////
.................... //// ////
.................... //// 05-13-05: Beta Release (Full Speed works) ////
.................... //// ////
.................... //// 03-21-05: Initial Alpha Release ////
.................... //// ////
.................... /////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2005 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... /////////////////////////////////////////////////////////////////////////
....................
.................... #IFNDEF __PIC18_USB_H__
.................... #DEFINE __PIC18_USB_H__
....................
.................... #DEFINE __USB_HARDWARE__
....................
.................... //let the USB Stack know that we are using a PIC with internal USB peripheral
.................... #DEFINE __PIC__ 1
....................
.................... #ifndef USB_USE_FULL_SPEED
.................... #define USB_USE_FULL_SPEED TRUE
.................... #endif
....................
.................... #ifndef USB_MAX_EP0_PACKET_LENGTH
.................... #if ((getenv("DEVICE")=="PIC18F2450") || (getenv("DEVICE")=="PIC18F4450"))
.................... //due to limited ram, force max packet length to 8 for this chip
.................... #define USB_MAX_EP0_PACKET_LENGTH 8
.................... #else
.................... #if USB_USE_FULL_SPEED==FALSE
.................... //slow speed requires 8byte max packet size for endpoint 0
.................... #DEFINE USB_MAX_EP0_PACKET_LENGTH 8
.................... #else
.................... //for full speed you can still use 8bytes, but 64 will be faster
.................... #DEFINE USB_MAX_EP0_PACKET_LENGTH 64
.................... #endif
.................... #endif
.................... #endif
....................
.................... #if (!USB_USE_FULL_SPEED && (USB_MAX_EP0_PACKET_LENGTH!=8))
.................... #error Slow speed devices must use a max packet size of 8 for endpoint 0!
.................... #endif
....................
.................... #if USB_MAX_EP0_PACKET_LENGTH < 8
.................... #error Max Endpoint 0 length can't be less than 8!
.................... #endif
....................
.................... #if USB_MAX_EP0_PACKET_LENGTH > 64
.................... #error Max Endpoint 0 length can't be greater than 64!
.................... #endif
....................
.................... #include <usb_hw_layer.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// usb_hw_layer.h ////
.................... //// ////
.................... //// HW Layer for the USB Stack. ////
.................... //// ////
.................... //// HW drivers for the USB stack must support this API. ////
.................... //// ////
.................... //// The HW driver must also have a token handler that will call ////
.................... //// usb_token_reset() when the device is init/reset, will call ////
.................... //// usb_isr_tok_setup_dne() when it receives a setup packet, ////
.................... //// will call usb_isr_tok_out_dne() when a new packet is received, ////
.................... //// and will call usb_isr_tok_in_dne() when a new packet is sent. ////
.................... //// See usb.h for documentation of these functions. ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// Version History: ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2009 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef __USB_HW_LAYER_H__
.................... #define __USB_HW_LAYER_H__
....................
.................... enum USB_DTS_BIT {USB_DTS_DATA1=1, USB_DTS_TOGGLE=2, USB_DTS_DATA0=0,
.................... USB_DTS_STALL=3, USB_DTS_USERX=4};
....................
....................
.................... // USER LEVEL FUNCTIONS:
....................
.................... /*****************************************************************************
.................... /* usb_init()
.................... /*
.................... /* Summary: See API section of USB.H for documentation.
.................... /*
.................... /*****************************************************************************/
.................... void usb_init(void);
....................
.................... /*****************************************************************************
.................... /* usb_init_cs()
.................... /*
.................... /* Summary: See API section of USB.H for documentation.
.................... /*
.................... /*****************************************************************************/
.................... void usb_init_cs(void);
....................
.................... /*****************************************************************************
.................... /* usb_task()
.................... /*
.................... /* Summary: See API section of USB.H for documentation.
.................... /*
.................... /*****************************************************************************/
.................... void usb_task(void);
....................
.................... /******************************************************************************
.................... /* usb_attach()
.................... /*
.................... /* Summary: Attach the D+/D- lines to the USB bus. Enable the USB peripheral.
.................... /*
.................... /* You should wait until UCON_SE0 is clear before enabling reset/idle interrupt.
.................... /*
.................... /* Shouldn't be called by user, let usb_task() handle this.
.................... /*
.................... /* NOTE: If you are writing a new HW driver, this routine should call
.................... /* usb_token_reset() to reset the CH9 stack.
.................... /*
.................... /*****************************************************************************/
.................... void usb_attach(void);
....................
.................... /******************************************************************************
.................... /* usb_detach()
.................... /*
.................... /* Summary: Remove the D+/D- lines from the USB bus. Basically, disable USB.
.................... /*
.................... /* Shouldn't be called by user, let usb_task() handle this.
.................... /*
.................... /* If the user does call this function while USB is connected, the USB
.................... /* peripheral will be disabled only momentarily because usb_task() will
.................... /* reconnect. But this is a great way to cause the PC/HOST to cause a USB
.................... /* reset of the device.
.................... /*
.................... /* NOTE: If you are writing a new HW driver, this routine should call
.................... /* usb_token_reset() to reset the CH9 stack.
.................... /*
.................... /*****************************************************************************/
.................... void usb_detach(void);
....................
.................... /******************************************************************************
.................... /* usb_put_packet()
.................... /*
.................... /* Input: endpoint - endpoint to send packet to (0..15).
.................... /* ptr - points to data to send.
.................... /* len - amount of data to send.
.................... /* toggle - whether to send data with a DATA0 pid, a DATA1 pid,
.................... /* or toggle from the last DATAx pid.
.................... /*
.................... /* Output: TRUE if data was sent correctly, FALSE if it was not. The only
.................... /* reason it will return FALSE is if because the TX buffer is still full
.................... /* from the last time it tried to send a packet.
.................... /*
.................... /* Summary: Sends one packet out the EP to the host. Notice that there is a
.................... /* difference between a packet and a message. If you wanted to send a
.................... /* 512 byte message on an endpoint that only supported 64 byte packets,
.................... /* this would be accomplished this by sending 8 64-byte packets,
.................... /* followed by a 0 length packet. If the last (or only packet) being
.................... /* sent is less than the max packet size defined in your descriptor
.................... /* then you do not need to send a 0 length packet to identify
.................... /* an end of message.
.................... /*
.................... /* usb_puts() (provided in usb.c) will send a multi-packet message
.................... /* correctly and know if a 0 lenght packet needs to be sent.
.................... /*
.................... /* The result will be invalid if the specified input has not been configured for
.................... /* use by the API with USB_EPx_TX_SIZE
.................... /*
.................... /*****************************************************************************/
.................... int1 usb_put_packet(int8 endpoint, int8 * ptr, unsigned int16 len, USB_DTS_BIT tgl);
....................
.................... /*******************************************************************************
.................... /* usb_get_packet(endpoint, *ptr, max)
.................... /*
.................... /* Input: endpoint - endpoint to get data from
.................... /* ptr - where to save data to local PIC RAM
.................... /* max - max amount of data to receive from buffer
.................... /*
.................... /* Output: the amount of data taken from the buffer and saved to ptr.
.................... /*
.................... /* NOTE - IF THERE IS NO PACKET TO GET YOU WILL GET INVALID RESULTS!
.................... /* VERIFY WITH USB_KBHIT() BEFORE YOU CALL USB_GET_PACKET()!
.................... /*
.................... /* Summary: Gets a packet of data from the USB endpoint buffer.
.................... /* Until this is called, if there is data in the receive buffer the
.................... /* PC/HOST will be prevented from sending more data. Upon completion
.................... /* of this call, the endpoint will be freed and the PC/HOST will be
.................... /* allowed to send a new packet. Only receives one packet, if you need
.................... /* to receive multiple packets or handle 0-length terminator packets,
.................... /* then use usb_gets().
.................... /*
.................... /* The result will be invalid if the specified input has not been configured for
.................... /* use by the API with USB_EPx_RX_SIZE
.................... /*
.................... /********************************************************************************/
.................... unsigned int16 usb_get_packet(int8 endpoint, int8 * ptr, unsigned int16 max);
....................
.................... /****************************************************************************
.................... /* usb_kbhit(endpoint)
.................... /*
.................... /* Input: endpoint - endpoint to check (0..15)
.................... /*
.................... /* Output: TRUE if there is new data in RX buffer, FALSE if there is not.
.................... /*
.................... /* Summary: Similar to kbhit(), sees if there is new data in the RX USB buffers.
.................... /* See API section of USB.H for more information.
.................... /*
.................... /* The result will be invalid if the specified input has not been configured for
.................... /* use by the API with USB_EPx_RX_SIZE
.................... /*
.................... /*****************************************************************************/
.................... int1 usb_kbhit(int8 en);
....................
.................... /******************************************************************************
.................... /* usb_tbe(endpoint)
.................... /*
.................... /* Input: endpoint - endpoint to check
.................... /* ptr - where to save data to local PIC RAM
.................... /* max - max amount of data to receive from buffer
.................... /*
.................... /* Output: returns TRUE if this endpoint's IN buffer (PIC-PC) is empty and ready
.................... /* returns FALSE if this endpoint's IN buffer is still processing the last
.................... /* transmit or if this endpoint is invalid.
.................... /*
.................... /* The result will be invalid if the specified input has not been configured for
.................... /* use by the API with USB_EPx_TX_SIZE
.................... /*
.................... /*****************************************************************************/
.................... int1 usb_tbe(int8 en);
....................
.................... //////////////// END USER LEVEL FUNCTIONS /////////////////////////////////////
....................
....................
.................... ///
.................... /// BEGIN STACK LEVEL FUNCTIONS: These functions are meant to be called by
.................... /// the USB stack, and are not meant to be called by the
.................... /// user/application.
.................... ///
....................
.................... /*****************************************************************************
.................... /* usb_stall_ep()
.................... /*
.................... /* Input: endpoint - endpoint to stall.
.................... /* top most bit indicates direction (set is IN, clear is OUT)
.................... /*
.................... /* Summary: Stalls specified endpoint. If endpoint is stalled it will
.................... /* send STALL packet if the host tries to access this endpoint's
.................... /* buffer.
.................... /*
.................... /* NOTE: WE ASSUME ENDPOINT IS VALID. USB.C SHOULD CHECK IF VALID BEFORE
.................... /* CALLING THIS ROUTINE.
.................... /*
.................... /*****************************************************************************/
.................... void usb_stall_ep(int8 endpoint);
....................
....................
.................... /*****************************************************************************
.................... /* usb_unstall_ep(endpoint, direction)
.................... /*
.................... /* Input: endpoint - endpoint to un-stall.
.................... /* top most bit indicates direction (set is IN, clear is OUT)
.................... /*
.................... /* Summary: Un-stalls endpoint.
.................... /*
.................... /* NOTE: WE ASSUME ENDPOINT IS VALID. USB.C SHOULD CHECK IF VALID BEFORE
.................... /* CALLING THIS ROUTINE.
.................... /*
.................... /*****************************************************************************/
.................... void usb_unstall_ep(int8 endpoint);
....................
.................... /*****************************************************************************
.................... /* usb_endpoint_stalled()
.................... /*
.................... /* Input: endpoint - endpoint to check
.................... /* top most bit indicates direction (set is IN, clear is OUT)
.................... /*
.................... /* Output: returns a TRUE if endpoint is stalled, FALSE if it is not.
.................... /*
.................... /* Summary: Looks to see if an endpoint is stalled, or not. Does not look to
.................... /* see if endpoint has been issued a STALL, just whether or not it is
.................... /* configured to STALL on the next packet. See Set_Feature and
.................... /* Clear_Feature Chapter 9 requests.
.................... /*
.................... /* NOTE: WE ASSUME ENDPOINT IS VALID. USB.C SHOULD CHECK IF VALID BEFORE
.................... /* CALLING THIS ROUTINE.
.................... /*
.................... /*****************************************************************************/
.................... int1 usb_endpoint_stalled(int8 endpoint);
....................
.................... /*****************************************************************************
.................... /* usb_set_address(address)
.................... /*
.................... /* Input: address - address the host specified that we use
.................... /*
.................... /* Summary: Configures the USB Peripheral for the specified device address.
.................... /* The host will now talk to use with the following address.
.................... /*
.................... /*****************************************************************************/
.................... void usb_set_address(int8 address);
....................
.................... /******************************************************************************
.................... /* usb_set_configured()
.................... /*
.................... /* Input: config - Configuration to use. 0 to uncofigure device.
.................... /*
.................... /* Summary: Configures or unconfigures device. If configuring device it will
.................... /* enable all the endpoints the user specified for this configuration.
.................... /* If un-configuring device it will disable all endpoints.
.................... /*
.................... /* NOTE: CCS only provides code to handle 1 configuration.
.................... /*
.................... /*****************************************************************************/
.................... void usb_set_configured(int8 config);
....................
.................... /******************************************************************************
.................... /* usb_disable_endpoints()
.................... /*
.................... /* Summary: Disables endpoints (all endpoints but 0)
.................... /*
.................... /*****************************************************************************/
.................... void usb_disable_endpoints(void);
....................
....................
.................... /*******************************************************************************
.................... /* usb_disable_endpoint()
.................... /*
.................... /* Input: Endpoint to disable (0..15)
.................... /*
.................... /* Summary: Disables specified endpoint
.................... /*
.................... /********************************************************************************/
.................... void usb_disable_endpoint(int8 en);
....................
.................... /**************************************************************
.................... /* usb_request_send_response(len)
.................... /* usb_request_get_data()
.................... /* usb_request_stall()
.................... /*
.................... /* Input: len - size of packet to send
.................... /*
.................... /* Summary: One of these 3 functions will be called by the USB stack after
.................... /* handling a SETUP packet.
.................... /*
.................... /* After we process a SETUP request, we have 1 of three responses:
.................... /* 1.) send a response IN packet
.................... /* 2.) wait for followup OUT packet(s) with data
.................... /* 3.) stall because we don't support that SETUP request
.................... /*
.................... /* If we are sending data, the array usb_ep0_tx_buffer[] will hold
.................... /* the response and the USB Request handler code will call
.................... /* usb_request_send_response() to let us know how big the packet is.
.................... /*
.................... /* If we are waiting for more data, usb_request_get_data() will
.................... /* be called by the USB request handler code to configure the EP0 OUT
.................... /* endpoint to be ready for more data
.................... /*
.................... /* If we don't support a request, usb_request_stall() will be called
.................... /* by the USB request handler code to stall the endpoint 0.
.................... /*
.................... /* The operation of these functions depends on how SETUP packets
.................... /* are handled in the hardware layer.
.................... /*
.................... /***************************************************************/
.................... void usb_request_send_response(unsigned int8 len);
.................... void usb_request_get_data(void);
.................... void usb_request_stall(void);
....................
....................
.................... #endif
....................
....................
.................... //////////////////////// EXTRA USER FUNCTIONS /////////////////////////////////
....................
.................... /**************************************************************
.................... /* usb_flush_in()
.................... /*
.................... /* Input: endpoint - which endpoint to mark for transfer
.................... /* len - length of data that is being tramsferred
.................... /* tgl - Data toggle synchronization for this packet
.................... /*
.................... /* Output: TRUE if success, FALSE if error (we don't control the endpoint)
.................... /*
.................... /* Summary: Marks the endpoint ready for transmission. You must
.................... /* have already loaded the endpoint buffer with data.
.................... /* (IN is PIC -> PC).
.................... /* This routine is useful if you want to setup an endpoint by
.................... /* writing to the buffer directly.
.................... /* This routine is not necessary if you use usb_put_packet().
.................... /***************************************************************/
.................... int1 usb_flush_in(int8 endpoint, int16 len, USB_DTS_BIT tgl);
....................
.................... /**************************************************************
.................... /* usb_flush_out()
.................... /*
.................... /* Input: endpoint - which endpoint to mark for release
.................... /* tgl - Data toggle synchronization to expect in the next packet
.................... /*
.................... /* Output: NONE
.................... /*
.................... /* Summary: Clears the previously received packet, and then marks this
.................... /* endpoint's receive buffer as ready for more data.
.................... /* (OUT is PC -> PIC). This routine is useful if you do not
.................... /* want to use usb_get_packet(), instead you want to handle with
.................... /* the endpoint buffer directly. Also see usb_rx_packet_size().
.................... /* This routine is not necessary if you use usb_get_packet().
.................... /***************************************************************/
.................... void usb_flush_out(int8 endpoint, USB_DTS_BIT tgl);
....................
.................... /**************************************************************
.................... /* usb_rx_packet_size()
.................... /*
.................... /* Input: endpoint - which endpoint to mark to check
.................... /*
.................... /* Output: Returns the number of bytes in the endpoint's receive buffer.
.................... /*
.................... /* Summary: Read the number of data stored in the receive buffer. When you
.................... /* have handled the data, use usb_flush_out() to clear the buffer. The
.................... /* result may be invalid if usb_kbhit() returns false for this endpoint.
.................... /* This routine is not necessary if you use usb_get_packet().
.................... /***************************************************************/
.................... int16 usb_rx_packet_size(int8 endpoint);
....................
.................... #ENDIF
....................
.................... #else
.................... #include <pic24_usb.h> //Microchip 18Fxx5x hardware layer for usb.c
.................... #endif
.................... #else
.................... #include <usbn960x.h>
.................... #endif
.................... #include <usb_desc_cdc.h> //USB Configuration and Device descriptors for this UBS device
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// usb_desc_cdc.h ////
.................... //// ////
.................... //// An example set of device / configuration descriptors for use with ////
.................... //// CCS's CDC Virtual COM Port driver (see usb_cdc.h) ////
.................... //// ////
.................... //// This file is part of CCS's PIC USB driver code. See USB.H ////
.................... //// for more documentation and a list of examples. ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// Version History: ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... //// 10/28/05: ////
.................... //// Bulk endpoint sizes updated to allow more than 255 byte ////
.................... //// packets. ////
.................... //// Changed device to USB 1.10 ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2005 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #IFNDEF __USB_DESCRIPTORS__
.................... #DEFINE __USB_DESCRIPTORS__
....................
.................... ///////// config options, although it's best to leave alone for this demo /////
.................... #define USB_CONFIG_PID 0x0033
.................... #define USB_CONFIG_VID 0x0461
.................... #define USB_CONFIG_BUS_POWER 100 //100mA (range is 0..500)
.................... #define USB_CONFIG_VERSION 0x0100 //01.00 //range is 00.00 to 99.99
.................... //////// end config ///////////////////////////////////////////////////////////
....................
.................... #DEFINE USB_HID_DEVICE FALSE
.................... #DEFINE USB_CDC_DEVICE TRUE
....................
.................... #define USB_CDC_COMM_IN_ENDPOINT 1
.................... #define USB_CDC_COMM_IN_SIZE 8
.................... #define USB_EP1_TX_ENABLE USB_ENABLE_INTERRUPT
.................... #define USB_EP1_TX_SIZE USB_CDC_COMM_IN_SIZE
....................
.................... //pic to pc endpoint config
.................... #define USB_CDC_DATA_IN_ENDPOINT 2
.................... #define USB_CDC_DATA_IN_SIZE 64
.................... #define USB_EP2_TX_ENABLE USB_ENABLE_BULK
.................... #define USB_EP2_TX_SIZE USB_CDC_DATA_IN_SIZE
....................
.................... //pc to pic endpoint config
.................... #define USB_CDC_DATA_OUT_ENDPOINT 2
.................... #define USB_CDC_DATA_OUT_SIZE 64
.................... #define USB_EP2_RX_ENABLE USB_ENABLE_BULK
.................... #define USB_EP2_RX_SIZE USB_CDC_DATA_OUT_SIZE
....................
.................... #include <usb.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// usb.h ////
.................... //// ////
.................... //// Function protypes, defintions and globals used by CCS USB driver ////
.................... //// ////
.................... //// This file is part of CCS's USB driver code ////
.................... //// ////
.................... //// The following USB examples are provided by CCS: ////
.................... //// ex_usb_mouse.c - A HID Mouse. ////
.................... //// ex_usb_hid.c - A custom application using HID protocol. ////
.................... //// ex_usb_kbmouse.c - A HID Mouse/Keyboard combo using multiple ////
.................... //// interfaces. ////
.................... //// ex_usb_kbmouse2.c - A HID Mouse/Keyboard combo using multiple ////
.................... //// HID Reports. ////
.................... //// ex_usb_scope.c - A digital oscilloscope using a custom ////
.................... //// protocol requiring custom Windows drivers. ////
.................... //// ex_usb_serial.c - ////
.................... //// ex_usb_serial2.c - Two examples of using the CDC driver for ////
.................... //// a virtual COM port. ////
.................... //// ex_usb_bootloader.c - CDC/Virtual COM port bootloader. ////
.................... //// ex_usb_loadmouse.c - A conversion of ex_usb_mouse.c that is ////
.................... //// compatible with ex_usb_mouse.c. ////
.................... //// ////
.................... //// ********************** API ********************* ////
.................... //// ////
.................... //// These are the functions that are meant to be called by the user: ////
.................... //// ////
.................... //// usb_init() - Initializes the USB stack, the USB peripheral and ////
.................... //// attaches the unit to the usb bus. Enables ////
.................... //// interrupts. Will wait in an infinite loop until ////
.................... //// the device enumerates - if you are using ////
.................... //// connection sense or if the processor should run ////
.................... //// even if it's not connected to USB then use ////
.................... //// usb_init_cs() instead. ////
.................... //// ////
.................... //// usb_init_cs() - A smaller usb_init(), does not attach unit ////
.................... //// to usb bus or enable interrupts. Since this does ////
.................... //// not attach to the USB, you must periodically call ////
.................... //// usb_task(). See usb_task() for more information. ////
.................... //// ////
.................... //// usb_task() - If usb_init_cs() was used to initiate the USB ////
.................... //// peripheral, usb_task() should then be called periodically ////
.................... //// to check the connection sense pin. If the connection ////
.................... //// sense pin denotes USB is connected and the USB peripheral ////
.................... //// is not attached, this will attach the USB peripheral ////
.................... //// so the PC can start the enumeration process (and it ////
.................... //// will enable interrupts). If the connection sense pin ////
.................... //// denotes USB is not attached and the USB peripheral is ////
.................... //// running, this will reset the USB peripheral and wait ////
.................... //// for USB to reconnect (and usb_enumerated() will start ////
.................... //// returning FALSE). If connection sense (USB_CON_SENSE_PIN) ////
.................... //// is not defined the usb_task() assumes that USB is always ////
.................... //// connected. ////
.................... //// ////
.................... //// usb_attached() - Returns TRUE if the device is attached to a ////
.................... //// USB cable. A macro that looks at the defined ////
.................... //// connection sense pin. If this returns TRUE ////
.................... //// it does not mean the PC has connected to it, ////
.................... //// you need to use usb_enumerated() to check this. ////
.................... //// ////
.................... //// usb_enumerated() - Returns TRUE if device has been enumerated ////
.................... //// (configured) by host, FALSE if it has not. ////
.................... //// Do not try to use the USB peripheral for ////
.................... //// sending and receiving packets until you ////
.................... //// are enumerated. ////
.................... //// ////
.................... //// usb_wait_for_enumeration() - Sits in an infinte loop until device ////
.................... //// is enumerated. ////
.................... //// ////
.................... //// usb_tbe(endpoint) - Returns TRUE if the endpoint transmit buffer ////
.................... //// is free and ready to accept a new packet for transmission. ////
.................... //// ////
.................... //// usb_put_packet(endpoint, ptr, len, tgl) - Sends one packet to the ////
.................... //// host. If you need to send a message that ////
.................... //// spans more than one packet then use ////
.................... //// usb_puts(). Fore more detailed documentation ////
.................... //// see usb_hw_layer.h ////
.................... //// ////
.................... //// usb_puts(endpoint, ptr, len, timeout) - Sends a multiple packet ////
.................... //// message to the host. If you only need to send one packet, ////
.................... //// it is more effecient to use usb_put_packet(). This is ////
.................... //// documented in more detail above the prototype in USB.H. ////
.................... //// ////
.................... //// usb_kbhit(endpoint) - Returns true if OUT endpoint contains data ////
.................... //// from host. This will remain TRUE until ////
.................... //// usb_put_packet() or usb_flush_out() used. ////
.................... //// This function will return an invalid response ////
.................... //// if specified endpoint is not enabled for ////
.................... //// receiving data. ////
.................... //// ////
.................... //// len = usb_get_packet(endpoint, ptr, max) - Gets one packet that ////
.................... //// from the host/PC. usb_kbhit() must return TRUE before you ////
.................... //// call this routine or your data may not be valid. This ////
.................... //// only receives one packet, if you are trying to receive a ////
.................... //// multi-packet message use usb_gets(). For more detailed ////
.................... //// documentation see usb_hw_layer.h. ////
.................... //// ////
.................... //// len = usb_gets(endpoint, ptr, max, timeout) - Gets multiple ////
.................... //// packets from the host, you would use this instead ////
.................... //// of usb_get_packet() if you wanted to handle multi-packet ////
.................... //// messages. This is documented in more detail above the ////
.................... //// prototype in USB.H. ////
.................... //// ////
.................... //// ////
.................... //// ********* DEFINITIONS / CONFIGURATION ********** ////
.................... //// ////
.................... //// The following definitions are declared here, but can be ////
.................... //// overwritten in your code. Unless needed otherwise, leave ////
.................... //// to default value. If confused about a definition read the ////
.................... //// comments at each defintion ////
.................... //// ////
.................... //// USB_HID_IDLE (TRUE) - Set to TRUE if your device supports ////
.................... //// Set_Idle HID class request. Set to ////
.................... //// False if you do not (device will ////
.................... //// send a Wrong-state if computer ////
.................... //// sends a Set_Idle / Get_Idle command) ////
.................... //// NOTE: If you set to TRUE you must ////
.................... //// provide your own code. See ////
.................... //// usb_isr_tkn_setup_ClassInterface() in ////
.................... //// usb.c ////
.................... //// ////
.................... //// USB_HID_BOOT_PROTOCOL (FALSE) - Set to TRUE if your device supports ////
.................... //// Set_Protocl HID class request. Set to ////
.................... //// False if you do not (device will ////
.................... //// send a Wrong-state if computer ////
.................... //// sends a Set_Protocl / Get_Protocol ////
.................... //// command). ////
.................... //// NOTE: If you set to TRUE you must ////
.................... //// provide your own code in the ////
.................... //// application that properly send boot ////
.................... //// or HID packets. ////
.................... //// ////
.................... //// USB_MAX_EP0_PACKET_LENGTH (8) - Max Packet size for Endpoint 0. ////
.................... //// The hardware level driver (ex ////
.................... //// pic18_usb.h will define this value if ////
.................... //// not already overwritten). Increasing ////
.................... //// this size will speed up the ////
.................... //// enumeration process. ////
.................... //// ////
.................... //// USB_EPx_RX_ENABLE (USB_ENABLE_DISABLED) - Where x is the ////
.................... //// endpoint number. Change this define ////
.................... //// to specify what kind of transfer method ////
.................... //// this RX (PC to device) endpoint uses. ////
.................... //// Here is the list of valid transfer methods: ////
.................... //// USB_ENABLE_CONTROL ////
.................... //// USB_ENABLE_ISOCHRONOUS ////
.................... //// USB_ENABLE_BULK ////
.................... //// USB_ENABLE_INTERRUPT ////
.................... //// USB_ENABLE_DISABLED ////
.................... //// Don't forget that you must specify the ////
.................... //// transfer method properly in your endpoint ////
.................... //// descriptor, too. ////
.................... //// ////
.................... //// USB_EPx_RX_SIZE (0) - For some hardware it is important to know ////
.................... //// how much memory to reserve for receiving ////
.................... //// packets. ////
.................... //// ////
.................... //// *** NOTE *** You must have both USB_EPx_RX_ENABLE defined and ////
.................... //// USB_EPx_RX_SIZE defined (non 0) to enable a RX ////
.................... //// endpoint. ////
.................... //// *** NOTE *** Endpoint 0 is always enabled. ////
.................... //// ////
.................... //// USB_EPx_TX_ENABLE (USB_ENABLE_DISABLED) - Where x is the ////
.................... //// endpoint number. Change this define ////
.................... //// to specify what kind of transfer method ////
.................... //// this TX (device to PC) endpoint uses. ////
.................... //// Here is the list of valid transfer methods: ////
.................... //// USB_ENABLE_CONTROL ////
.................... //// USB_ENABLE_ISOCHRONOUS ////
.................... //// USB_ENABLE_BULK ////
.................... //// USB_ENABLE_INTERRUPT ////
.................... //// USB_ENABLE_DISABLED ////
.................... //// Don't forget that you must specify the ////
.................... //// transfer method properly in your endpoint ////
.................... //// descriptor, too. ////
.................... //// ////
.................... //// USB_EPx_TX_SIZE (0) - For some hardware it is important to know ////
.................... //// how much memory to reserve for transmitting ////
.................... //// packets. ////
.................... //// ////
.................... //// *** NOTE *** You must have both USB_EPx_TX_ENABLE defined and ////
.................... //// USB_EPx_TX_SIZE defined (non 0) to enable a TX ////
.................... //// endpoint. ////
.................... //// ////
.................... //// ////
.................... //// USB_HID_DEVICE (TRUE) - HID devices require extra code to handle ////
.................... //// HID requests. You can disable to save ////
.................... //// ROM space if you are not using a HID ////
.................... //// device. If you are not using a HID ////
.................... //// device you must provide your own O/S ////
.................... //// (Windows) driver. ////
.................... //// ////
.................... //// The other definitions should not be changed. ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// Version History: ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... //// July 13th, 2005: ////
.................... //// usb_ep_tx_size[] and usb_ep_rx_size[] changed to 16bits ////
.................... //// ////
.................... //// June 20th, 2005: ////
.................... //// Initial 18fxx5x release ////
.................... //// ////
.................... //// May 13th, 2005: ////
.................... //// Beta release, only works with 18Fxx5x hardware layer. ////
.................... //// Now supports multiple interfaces (many defines in descriptors ////
.................... //// will have to be changed, see examples) ////
.................... //// ////
.................... //// Mar 21st, 2005: ////
.................... //// Initial Alpha Release with PIC18Fxx5x support. (ONLY TESTED ////
.................... //// WITH 18F4550) ////
.................... //// usb_gets() and usb_puts() changed (see usb.c) ////
.................... //// ////
.................... //// June 24th, 2004: ////
.................... //// Optimization and cleanup. ////
.................... //// The following definitions changed: ////
.................... //// USB_EPx_TX_ENABLE and USB_EPx_RX_ENABLE have changed. See usb.h ////
.................... //// USB_CONFIG_DESCRIPTORS[] removed ////
.................... //// USB_CONFIG_DESC_LEN changed to USB_DESC_CONFIG_LEN ////
.................... //// USB_INTERFACE_DESC_LEN changed to USB_DESC_INTERFACE_LEN ////
.................... //// USB_CLASS_DESC_LEN changed to USB_DESC_CLASS_LEN ////
.................... //// USB_ENDPOINT_DESC_LEN changed to USB_DESC_ENDPOINT_LEN ////
.................... //// USB_CONFIG_DESC_KEY changed to USB_DESC_CONFIG_TYPE ////
.................... //// USB_INTERFACE_DESC_KEY changed to USB_DESC_INTERFACE_TYPE ////
.................... //// USB_CLASS_DESC_KEY changed to USB_DESC_CLASS_TYPE ////
.................... //// USB_ENDPOINT_DESC_KEY changed to USB_DESC_ENDPOINT_TYPE ////
.................... //// USB_STRING_X[] arrays removed, see USB_STRING_DESC[] and ////
.................... //// USB_STRING_DESC_OFFSET[] ////
.................... //// dev_req, curr_config, status_device and getdesc_type global ////
.................... //// variables moved into struct USB_stack_status ////
.................... //// ////
.................... //// October 15th, 2003: Support for boot protocol added. ////
.................... //// Set USB_HID_BOOT_PROTOCOL to TRUE to support this. ////
.................... //// The array hid_protocol[] saves which protocol mode each ////
.................... //// interface is in. It is your applications job to send ////
.................... //// data that either fit the boot protocol or HID protocol. ////
.................... //// ////
.................... //// May 6th, 2003: Fixed a potential stack overflow using PCM ////
.................... //// ////
.................... //// October 29th, 2002: New definition added to USB_STATES ////
.................... //// ////
.................... //// August 2nd, 2002: Initial Public Release ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2009 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #IFNDEF __USB_PROTOTYPES__
.................... #DEFINE __USB_PROTOTYPES__
....................
.................... //// CONFIGURATION ////////////////////////////////////////////////////////////
....................
.................... #ifndef USB_CON_SENSE_PIN
.................... #define USB_CON_SENSE_PIN 0
.................... #endif
....................
.................... #IFNDEF USB_HID_BOOT_PROTOCOL
.................... #DEFINE USB_HID_BOOT_PROTOCOL FALSE
.................... #ENDIF
....................
.................... #IFNDEF USB_HID_IDLE
.................... #DEFINE USB_HID_IDLE FALSE
.................... #ENDIF
....................
.................... //should the compiler add the extra HID handler code? Defaults to yes.
.................... #IFNDEF USB_HID_DEVICE
.................... #DEFINE USB_HID_DEVICE TRUE
.................... #ENDIF
....................
.................... #IFNDEF USB_CDC_DEVICE
.................... #DEFINE USB_CDC_DEVICE FALSE
.................... #ENDIF
....................
.................... //set to false to opt for less RAM, true to opt for less ROM
.................... #ifndef USB_OPT_FOR_ROM
.................... #define USB_OPT_FOR_ROM TRUE
.................... #endif
....................
.................... #IFNDEF USB_MAX_EP0_PACKET_LENGTH
.................... #DEFINE USB_MAX_EP0_PACKET_LENGTH 8
.................... #ENDIF
....................
....................
.................... ////// USER-LEVEL API /////////////////////////////////////////////////////////
....................
.................... /**************************************************************
.................... /* usb_enumerated()
.................... /*
.................... /* Input: Global variable USB_Curr_Config
.................... /* Returns: Returns a 1 if device is configured / enumerated,
.................... /* Returns a 0 if device is un-configured / not enumerated.
.................... /*
.................... /* Summary: See API section of USB.H for more documentation.
.................... /***************************************************************/
.................... int1 usb_enumerated(void);
....................
.................... /**************************************************************
.................... /* usb_wait_for_enumeration()
.................... /*
.................... /* Input: Global variable USB_Curr_Config
.................... /*
.................... /* Summary: Waits in-definately until device is configured / enumerated.
.................... /* See API section of USB.H for more information.
.................... /***************************************************************/
.................... void usb_wait_for_enumeration(void);
....................
.................... /****************************************************************************
.................... /* usb_gets(endpoint, ptr, max, timeout)
.................... /*
.................... /* Input: endpoint - endpoint to get data from
.................... /* ptr - place / array to store data to
.................... /* max - max amount of data to get from USB and store into ptr
.................... /* timeout - time in milliseconds, for each packet, to wait before
.................... /* timeout. set to 0 for no timeout.
.................... /*
.................... /* Output: Amount of data returned. It may be less than max.
.................... /*
.................... /* Summary: Gets data from the host. Will get multiple-packet messages
.................... /* and finish when either it receives a 0-len packet or a packet
.................... /* of less size than maximum.
.................... /*
.................... /*****************************************************************************/
.................... unsigned int16 usb_gets(int8 endpoint, int8 * ptr, unsigned int16 max, unsigned int16 timeout);
....................
.................... /****************************************************************************
.................... /* usb_puts()
.................... /*
.................... /* Inputs: endpoint - endpoint to send data out
.................... /* ptr - points to array of data to send
.................... /* len - amount of data to send
.................... /* timeout - time in milli-seconds, for each packet, to wait before
.................... /* timeout. set to 0 for no timeout.
.................... /*
.................... /* Outputs: Returns TRUE if message sent succesfully, FALSE if it was not
.................... /* sent before timeout period expired.
.................... /*
.................... /* Summary: Used for sending multiple packets of data as one message. This
.................... /* function can still be used to send messages consiting of only one
.................... /* packet. See usb_put_packet() documentation for the rules about when
.................... /* multiple packet messages or 0-lenght packets are needed.
.................... /*
.................... /*****************************************************************************/
.................... int1 usb_puts(int8 endpoint, int8 * ptr, unsigned int16 len, unsigned int8 timeout);
....................
.................... /******************************************************************************
.................... /* usb_attached()
.................... /*
.................... /* Summary: Returns TRUE if the device is attached to a USB cable.
.................... /* See the API section of USB.H for more documentation.
.................... /*
.................... /*****************************************************************************/
.................... #if USB_CON_SENSE_PIN
.................... #define usb_attached() input(USB_CON_SENSE_PIN)
.................... #else
.................... #define usb_attached() TRUE
.................... #endif
....................
.................... ////// END USER-LEVEL API /////////////////////////////////////////////////////
....................
....................
.................... ////// STACK-LEVEL API USED BY HW DRIVERS ////////////////////////////////////
....................
.................... enum USB_STATES {GET_DESCRIPTOR=1,SET_ADDRESS=2,NONE=0};
....................
.................... enum USB_GETDESC_TYPES {USB_GETDESC_CONFIG_TYPE=0,USB_GETDESC_HIDREPORT_TYPE=1,USB_GETDESC_STRING_TYPE=2,USB_GETDESC_DEVICE_TYPE=3};
....................
.................... #if USB_OPT_FOR_ROM
.................... typedef struct {
.................... USB_STATES dev_req; //what did the last setup token set us up to do?. init at none
.................... int curr_config; //our current config. start at none/powered (NOT THAT THIS LIMITS US TO 3 CONFIGURATIONS)
.................... int status_device; //Holds our state for Set_Feature and Clear_Feature
.................... USB_GETDESC_TYPES getdesc_type; //which get_descriptor() we are handling
.................... } TYPE_USB_STACK_STATUS;
.................... #else
.................... typedef struct {
.................... USB_STATES dev_req:2; //what did the last setup token set us up to do?. init at none
.................... int Curr_config:2; //our current config. start at none/powered (NOT THAT THIS LIMITS US TO 3 CONFIGURATIONS)
.................... int status_device:2; //Holds our state for Set_Feature and Clear_Feature
.................... USB_GETDESC_TYPES getdesc_type:2; //which get_descriptor() we are handling
.................... } TYPE_USB_STACK_STATUS;
.................... #endif
....................
.................... extern TYPE_USB_STACK_STATUS USB_stack_status;
....................
.................... /**************************************************************
.................... /* usb_token_reset()
.................... /*
.................... /* Output: No output (but many global registers are modified)
.................... /*
.................... /* Summary: Resets the token handler to initial (unconfigured) state.
.................... /***************************************************************/
.................... void usb_token_reset(void);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_setup_dne()
.................... /*
.................... /* Input: usb_ep0_rx_buffer[] contains the the setup packet.
.................... /*
.................... /* Output: None (many globals are changed)
.................... /*
.................... /* Summary: This function is that handles the setup token.
.................... /* We must handle all relevant requests, such as Set_Configuration,
.................... /* Get_Descriptor, etc.
.................... /*
.................... /* usb_ep0_rx_buffer[] contains setup data packet, which has the
.................... /* following records:
.................... /* -------------------------------------------------------------------------------------------
.................... /* usb_ep0_rx_buffer[ 0 ]=bmRequestType; Where the setup packet goes
.................... /* bit7 (0) host-to-device
.................... /* (1) device-to-host
.................... /* bit6-5 (00) usb standard request;
.................... /* (01) class request;
.................... /* (10) vendor request
.................... /* (11) reserved
.................... /* bit4-0 (0000) device
.................... /* (0001) interface
.................... /* (0010) endpoint
.................... /* (0011) other element
.................... /* (0100) to (1111) reserved
.................... /* usb_ep0_rx_buffer[ 1 ]=bRequest ; the request
.................... /* usb_ep0_rx_buffer[2,3]=wValue ; a value which corresponds to request
.................... /* usb_ep0_rx_buffer[4,5]=wIndex ; could correspond to interface or endpoint...
.................... /* usb_ep0_rx_buffer[6,7]=wLength ; number of bytes in next data packet;
.................... /* for host-to-device, this exactly how many bytes in data packet.
.................... /* for device-to-host, this is the maximum bytes that can fit one packet.
.................... /***************************************************************/
.................... void usb_isr_tok_setup_dne(void);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_out_dne()
.................... /*
.................... /* Input: endpoint contains which endpoint we are receiving data (0..15)
.................... /*
.................... /* Summary: Processes out tokens (out is respective of the host, so actualy
.................... /* incoming to the pic), but not out setup tokens. Normally when
.................... /* data is received it is left in the buffer (user would use
.................... /* usb_kbhit() and usb_get_packet() to receive data), but certain
.................... /* libraries (like CDC) have to answer setup packets.
.................... /*
.................... /***************************************************************/
.................... void usb_isr_tok_out_dne(int8 endpoint);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_in_dne(endpoint)
.................... /*
.................... /* Input: endpoint - which endpoint we are processing a setup token.
.................... /*
.................... /* Summary: This handles an IN packet (HOST <- PIC). For endpoint 0, this
.................... /* is usually to setup a response packet to a setup packet. Endpoints 1..15
.................... /* are generally ignored, and the user has to use usb_tbe() to determine if
.................... /* if the buffer is ready for a new transmit packet (there are special cases,
.................... /* like CDC which handles the CDC protocl).
.................... /*
.................... /***************************************************************/
.................... void usb_isr_tok_in_dne(int8 endpoint);
....................
.................... ////// END STACK-LEVEL API USED BY HW DRIVERS /////////////////////////////////
....................
....................
.................... //CCS only supports one configuration at this time
.................... #DEFINE USB_NUM_CONFIGURATIONS 1 //DO NOT CHANGE
....................
.................... //PID values for tokens (see page 48 of USB Complete ed.1)
.................... #define PID_IN 0x09 //device to host transactions
.................... #define PID_OUT 0x01 //host to device transactions
.................... #define PID_SETUP 0x0D //host to device setup transaction
.................... #define PID_ACK 0x02 //receiver accepts error-free data packet
.................... #define PID_DATA0 0x03 //data packet with even sync bit
.................... #define PID_SOF 0x05 //start of framer marker and frame number
.................... #define PID_NAK 0x0A //receiver can't accept data or sender cant send data or has no data to transmit
.................... #define PID_DATA1 0x0B //data packet with odd sync bit
.................... #define PID_PRE 0x0C //preamble issued by host. enables downstream traffic to low-speed device
.................... #define PID_STALL 0x0E //a control request isnt supported or the endpoint is halted
....................
.................... //Key which identifies descritpors
.................... #DEFINE USB_DESC_DEVICE_TYPE 0x01 //#DEFINE USB_DEVICE_DESC_KEY 0x01
.................... #DEFINE USB_DESC_CONFIG_TYPE 0x02 //#DEFINE USB_CONFIG_DESC_KEY 0x02
.................... #DEFINE USB_DESC_STRING_TYPE 0x03 //#DEFINE USB_STRING_DESC_KEY 0x03
.................... #DEFINE USB_DESC_INTERFACE_TYPE 0x04 //#DEFINE USB_INTERFACE_DESC_KEY 0x04
.................... #DEFINE USB_DESC_ENDPOINT_TYPE 0x05 //#DEFINE USB_ENDPOINT_DESC_KEY 0x05
.................... #DEFINE USB_DESC_CLASS_TYPE 0x21 //#DEFINE USB_CLASS_DESC_KEY 0x21
.................... #DEFINE USB_DESC_HIDREPORT_TYPE 0x22
....................
.................... //The length of each descriptor
.................... #DEFINE USB_DESC_DEVICE_LEN 18 //#DEFINE USB_DEVICE_DESC_LEN 18
.................... #DEFINE USB_DESC_CONFIG_LEN 9 //#DEFINE USB_CONFIG_DESC_LEN 9
.................... #DEFINE USB_DESC_INTERFACE_LEN 9 //#DEFINE USB_INTERFACE_DESC_LEN 9
.................... #DEFINE USB_DESC_CLASS_LEN 9 //#DEFINE USB_CLASS_DESC_LEN 9
.................... #DEFINE USB_DESC_ENDPOINT_LEN 7 //#DEFINE USB_ENDPOINT_DESC_LEN 7
....................
.................... //Standard USB Setup bRequest Codes
.................... #define USB_STANDARD_REQUEST_GET_STATUS 0x00
.................... #define USB_STANDARD_REQUEST_CLEAR_FEATURE 0x01
.................... #define USB_STANDARD_REQUEST_SET_FEATURE 0x03
.................... #define USB_STANDARD_REQUEST_SET_ADDRESS 0x05
.................... #define USB_STANDARD_REQUEST_GET_DESCRIPTOR 0x06
.................... #define USB_STANDARD_REQUEST_SET_DESCRIPTOR 0x07
.................... #define USB_STANDARD_REQUEST_GET_CONFIGURATION 0x08
.................... #define USB_STANDARD_REQUEST_SET_CONFIGURATION 0x09
.................... #define USB_STANDARD_REQUEST_GET_INTERFACE 0x0A
.................... #define USB_STANDARD_REQUEST_SET_INTERFACE 0x0B
.................... #define USB_STANDARD_REQUEST_SYNCH_FRAME 0x0C
....................
.................... //HID Class Setup bRequest Codes
.................... #define USB_HID_REQUEST_GET_REPORT 0x01
.................... #define USB_HID_REQUEST_GET_IDLE 0x02
.................... #define USB_HID_REQUEST_GET_PROTOCOL 0x03
.................... #define USB_HID_REQUEST_SET_REPORT 0x09
.................... #define USB_HID_REQUEST_SET_IDLE 0x0A
.................... #define USB_HID_REQUEST_SET_PROTOCOL 0x0B
....................
.................... //types of endpoints as defined in the descriptor
.................... #define USB_ENDPOINT_TYPE_CONTROL 0x00
.................... #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
.................... #define USB_ENDPOINT_TYPE_BULK 0x02
.................... #define USB_ENDPOINT_TYPE_INTERRUPT 0x03
....................
.................... //types of endpoints used internally in this api
.................... #define USB_ENABLE_DISABLED -1
.................... #define USB_ENABLE_BULK USB_ENDPOINT_TYPE_BULK
.................... #define USB_ENABLE_ISOCHRONOUS USB_ENDPOINT_TYPE_ISOCHRONOUS
.................... #define USB_ENABLE_INTERRUPT USB_ENDPOINT_TYPE_INTERRUPT
.................... #define USB_ENABLE_CONTROL USB_ENDPOINT_TYPE_CONTROL
....................
....................
.................... //*** ENABLE RX ENDPOINTS AND BUFFERS
....................
.................... //--------- endpoint 0 defines ----------
.................... #define USB_EP0_TX_ENABLE USB_ENABLE_CONTROL
.................... #define USB_EP0_RX_ENABLE USB_ENABLE_CONTROL
.................... #define USB_EP0_RX_SIZE USB_MAX_EP0_PACKET_LENGTH //endpoint 0 is setup, and should always be the MAX_PACKET_LENGTH. Slow speed specifies 8
.................... #define USB_EP0_TX_SIZE USB_MAX_EP0_PACKET_LENGTH //endpoint 0 is setup, and should always be the MAX_PACKET_LENGTH. Slow speed specifies 8
....................
.................... //--------- endpoint 1 defines ----------
.................... #ifndef USB_EP1_TX_ENABLE
.................... #define USB_EP1_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP1_RX_ENABLE
.................... #define USB_EP1_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP1_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP1_RX_SIZE
.................... #undef USB_EP1_RX_SIZE
.................... #endif
.................... #define USB_EP1_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP1_RX_SIZE
.................... #error You enabled EP1 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP1_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP1_TX_SIZE
.................... #undef USB_EP1_TX_SIZE
.................... #endif
.................... #define USB_EP1_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP1_TX_SIZE
.................... #error You enabled EP1 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 2 defines ----------
.................... #ifndef USB_EP2_TX_ENABLE
.................... #define USB_EP2_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP2_RX_ENABLE
.................... #define USB_EP2_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP2_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP2_RX_SIZE
.................... #undef USB_EP2_RX_SIZE
.................... #endif
.................... #define USB_EP2_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP2_RX_SIZE
.................... #error You enabled EP2 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP2_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP2_TX_SIZE
.................... #undef USB_EP2_TX_SIZE
.................... #endif
.................... #define USB_EP2_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP2_TX_SIZE
.................... #error You enabled EP2 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 3 defines ----------
.................... #ifndef USB_EP3_TX_ENABLE
.................... #define USB_EP3_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP3_RX_ENABLE
.................... #define USB_EP3_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP3_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP3_RX_SIZE
.................... #undef USB_EP3_RX_SIZE
.................... #endif
.................... #define USB_EP3_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP3_RX_SIZE
.................... #error You enabled EP3 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP3_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP3_TX_SIZE
.................... #undef USB_EP3_TX_SIZE
.................... #endif
.................... #define USB_EP3_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP3_TX_SIZE
.................... #error You enabled EP3 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 4 defines ----------
.................... #ifndef USB_EP4_TX_ENABLE
.................... #define USB_EP4_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP4_RX_ENABLE
.................... #define USB_EP4_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP4_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP4_RX_SIZE
.................... #undef USB_EP4_RX_SIZE
.................... #endif
.................... #define USB_EP4_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP4_RX_SIZE
.................... #error You enabled EP4 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP4_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP4_TX_SIZE
.................... #undef USB_EP4_TX_SIZE
.................... #endif
.................... #define USB_EP4_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP4_TX_SIZE
.................... #error You enabled EP4 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 5 defines ----------
.................... #ifndef USB_EP5_TX_ENABLE
.................... #define USB_EP5_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP5_RX_ENABLE
.................... #define USB_EP5_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP5_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP5_RX_SIZE
.................... #undef USB_EP5_RX_SIZE
.................... #endif
.................... #define USB_EP5_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP5_RX_SIZE
.................... #error You enabled EP5 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP5_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP5_TX_SIZE
.................... #undef USB_EP5_TX_SIZE
.................... #endif
.................... #define USB_EP5_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP5_TX_SIZE
.................... #error You enabled EP5 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 6 defines ----------
.................... #ifndef USB_EP6_TX_ENABLE
.................... #define USB_EP6_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP6_RX_ENABLE
.................... #define USB_EP6_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP6_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP6_RX_SIZE
.................... #undef USB_EP6_RX_SIZE
.................... #endif
.................... #define USB_EP6_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP6_RX_SIZE
.................... #error You enabled EP6 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP6_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP6_TX_SIZE
.................... #undef USB_EP6_TX_SIZE
.................... #endif
.................... #define USB_EP6_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP6_TX_SIZE
.................... #error You enabled EP6 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 7 defines ----------
.................... #ifndef USB_EP7_TX_ENABLE
.................... #define USB_EP7_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP7_RX_ENABLE
.................... #define USB_EP7_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP7_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP7_RX_SIZE
.................... #undef USB_EP7_RX_SIZE
.................... #endif
.................... #define USB_EP7_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP7_RX_SIZE
.................... #error You enabled EP7 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP7_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP7_TX_SIZE
.................... #undef USB_EP7_TX_SIZE
.................... #endif
.................... #define USB_EP7_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP7_TX_SIZE
.................... #error You enabled EP7 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 8 defines ----------
.................... #ifndef USB_EP8_TX_ENABLE
.................... #define USB_EP8_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP8_RX_ENABLE
.................... #define USB_EP8_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP8_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP8_RX_SIZE
.................... #undef USB_EP8_RX_SIZE
.................... #endif
.................... #define USB_EP8_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP8_RX_SIZE
.................... #error You enabled EP8 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP8_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP8_TX_SIZE
.................... #undef USB_EP8_TX_SIZE
.................... #endif
.................... #define USB_EP8_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP8_TX_SIZE
.................... #error You enabled EP8 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 9 defines ----------
.................... #ifndef USB_EP9_TX_ENABLE
.................... #define USB_EP9_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP9_RX_ENABLE
.................... #define USB_EP9_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP9_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP9_RX_SIZE
.................... #undef USB_EP9_RX_SIZE
.................... #endif
.................... #define USB_EP9_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP9_RX_SIZE
.................... #error You enabled EP9 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP9_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP9_TX_SIZE
.................... #undef USB_EP9_TX_SIZE
.................... #endif
.................... #define USB_EP9_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP9_TX_SIZE
.................... #error You enabled EP9 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 10 defines ----------
.................... #ifndef USB_EP10_TX_ENABLE
.................... #define USB_EP10_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP10_RX_ENABLE
.................... #define USB_EP10_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP10_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP10_RX_SIZE
.................... #undef USB_EP10_RX_SIZE
.................... #endif
.................... #define USB_EP10_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP10_RX_SIZE
.................... #error You enabled EP10 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP10_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP10_TX_SIZE
.................... #undef USB_EP10_TX_SIZE
.................... #endif
.................... #define USB_EP10_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP10_TX_SIZE
.................... #error You enabled EP10 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 11 defines ----------
.................... #ifndef USB_EP11_TX_ENABLE
.................... #define USB_EP11_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP11_RX_ENABLE
.................... #define USB_EP11_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP11_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP11_RX_SIZE
.................... #undef USB_EP11_RX_SIZE
.................... #endif
.................... #define USB_EP11_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP11_RX_SIZE
.................... #error You enabled EP11 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP11_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP11_TX_SIZE
.................... #undef USB_EP11_TX_SIZE
.................... #endif
.................... #define USB_EP11_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP11_TX_SIZE
.................... #error You enabled EP11 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 12 defines ----------
.................... #ifndef USB_EP12_TX_ENABLE
.................... #define USB_EP12_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP12_RX_ENABLE
.................... #define USB_EP12_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP12_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP12_RX_SIZE
.................... #undef USB_EP12_RX_SIZE
.................... #endif
.................... #define USB_EP12_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP12_RX_SIZE
.................... #error You enabled EP12 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP12_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP12_TX_SIZE
.................... #undef USB_EP12_TX_SIZE
.................... #endif
.................... #define USB_EP12_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP12_TX_SIZE
.................... #error You enabled EP12 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 13 defines ----------
.................... #ifndef USB_EP13_TX_ENABLE
.................... #define USB_EP13_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP13_RX_ENABLE
.................... #define USB_EP13_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP13_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP13_RX_SIZE
.................... #undef USB_EP13_RX_SIZE
.................... #endif
.................... #define USB_EP13_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP13_RX_SIZE
.................... #error You enabled EP13 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP13_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP13_TX_SIZE
.................... #undef USB_EP13_TX_SIZE
.................... #endif
.................... #define USB_EP13_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP13_TX_SIZE
.................... #error You enabled EP13 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 14 defines ----------
.................... #ifndef USB_EP14_TX_ENABLE
.................... #define USB_EP14_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP14_RX_ENABLE
.................... #define USB_EP14_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP14_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP14_RX_SIZE
.................... #undef USB_EP14_RX_SIZE
.................... #endif
.................... #define USB_EP14_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP14_RX_SIZE
.................... #error You enabled EP14 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP14_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP14_TX_SIZE
.................... #undef USB_EP14_TX_SIZE
.................... #endif
.................... #define USB_EP14_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP14_TX_SIZE
.................... #error You enabled EP14 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 15 defines ----------
.................... #ifndef USB_EP15_TX_ENABLE
.................... #define USB_EP15_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP15_RX_ENABLE
.................... #define USB_EP15_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP15_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP15_RX_SIZE
.................... #undef USB_EP15_RX_SIZE
.................... #endif
.................... #define USB_EP15_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP15_RX_SIZE
.................... #error You enabled EP15 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP15_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP15_TX_SIZE
.................... #undef USB_EP15_TX_SIZE
.................... #endif
.................... #define USB_EP15_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP15_TX_SIZE
.................... #error You enabled EP15 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... const int8 usb_ep_tx_type[16]={
.................... USB_EP0_TX_ENABLE, USB_EP1_TX_ENABLE, USB_EP2_TX_ENABLE,
.................... USB_EP3_TX_ENABLE, USB_EP4_TX_ENABLE, USB_EP5_TX_ENABLE,
.................... USB_EP6_TX_ENABLE, USB_EP7_TX_ENABLE, USB_EP8_TX_ENABLE,
.................... USB_EP9_TX_ENABLE, USB_EP10_TX_ENABLE, USB_EP11_TX_ENABLE,
.................... USB_EP12_TX_ENABLE, USB_EP13_TX_ENABLE, USB_EP14_TX_ENABLE,
.................... USB_EP15_TX_ENABLE
.................... };
....................
.................... const int8 usb_ep_rx_type[16]={
.................... USB_EP0_RX_ENABLE, USB_EP1_RX_ENABLE, USB_EP2_RX_ENABLE,
.................... USB_EP3_RX_ENABLE, USB_EP4_RX_ENABLE, USB_EP5_RX_ENABLE,
.................... USB_EP6_RX_ENABLE, USB_EP7_RX_ENABLE, USB_EP8_RX_ENABLE,
.................... USB_EP9_RX_ENABLE, USB_EP10_RX_ENABLE, USB_EP11_RX_ENABLE,
.................... USB_EP12_RX_ENABLE, USB_EP13_RX_ENABLE, USB_EP14_RX_ENABLE,
.................... USB_EP15_RX_ENABLE
.................... };
....................
.................... const unsigned int16 usb_ep_tx_size[16]={
.................... USB_EP0_TX_SIZE, USB_EP1_TX_SIZE, USB_EP2_TX_SIZE,
.................... USB_EP3_TX_SIZE, USB_EP4_TX_SIZE, USB_EP5_TX_SIZE,
.................... USB_EP6_TX_SIZE, USB_EP7_TX_SIZE, USB_EP8_TX_SIZE,
.................... USB_EP9_TX_SIZE, USB_EP10_TX_SIZE, USB_EP11_TX_SIZE,
.................... USB_EP12_TX_SIZE, USB_EP13_TX_SIZE, USB_EP14_TX_SIZE,
.................... USB_EP15_TX_SIZE
.................... };
....................
.................... const unsigned int16 usb_ep_rx_size[16]={
.................... USB_EP0_RX_SIZE, USB_EP1_RX_SIZE, USB_EP2_RX_SIZE,
.................... USB_EP3_RX_SIZE, USB_EP4_RX_SIZE, USB_EP5_RX_SIZE,
.................... USB_EP6_RX_SIZE, USB_EP7_RX_SIZE, USB_EP8_RX_SIZE,
.................... USB_EP9_RX_SIZE, USB_EP10_RX_SIZE, USB_EP11_RX_SIZE,
.................... USB_EP12_RX_SIZE, USB_EP13_RX_SIZE, USB_EP14_RX_SIZE,
.................... USB_EP15_RX_SIZE
.................... };
....................
.................... #ENDIF
....................
....................
.................... //////////////////////////////////////////////////////////////////
.................... ///
.................... /// start config descriptor
.................... /// right now we only support one configuration descriptor.
.................... /// the config, interface, class, and endpoint goes into this array.
.................... ///
.................... //////////////////////////////////////////////////////////////////
....................
.................... #DEFINE USB_TOTAL_CONFIG_LEN 67 //config+interface+class+endpoint+endpoint (2 endpoints)
....................
.................... const char USB_CONFIG_DESC[] = {
.................... //IN ORDER TO COMPLY WITH WINDOWS HOSTS, THE ORDER OF THIS ARRAY MUST BE:
.................... // config(s)
.................... // interface(s)
.................... // class(es)
.................... // endpoint(s)
....................
.................... //config_descriptor for config index 1
.................... USB_DESC_CONFIG_LEN, //length of descriptor size ==0
.................... USB_DESC_CONFIG_TYPE, //constant CONFIGURATION (CONFIGURATION 0x02) ==1
.................... USB_TOTAL_CONFIG_LEN,0, //size of all data returned for this config ==2,3
.................... 2, //number of interfaces this device supports ==4
.................... 0x01, //identifier for this configuration. (IF we had more than one configurations) ==5
.................... 0x00, //index of string descriptor for this configuration ==6
.................... #if USB_CONFIG_BUS_POWER
.................... 0x80, //bit 6=1 if self powered, bit 5=1 if supports remote wakeup (we don't), bits 0-4 unused and bit7=1 ==7
.................... #else
.................... 0xC0, //bit 6=1 if self powered, bit 5=1 if supports remote wakeup (we don't), bits 0-4 unused and bit7=1 ==7
.................... #endif
.................... USB_CONFIG_BUS_POWER/2, //maximum bus power required (maximum milliamperes/2) (0x32 = 100mA) ==8
....................
....................
.................... //interface descriptor 0 (comm class interface)
.................... USB_DESC_INTERFACE_LEN, //length of descriptor =9
.................... USB_DESC_INTERFACE_TYPE, //constant INTERFACE (INTERFACE 0x04) =10
.................... 0x00, //number defining this interface (IF we had more than one interface) ==11
.................... 0x00, //alternate setting ==12
.................... 1, //number of endpoints ==13
.................... 0x02, //class code, 02 = Comm Interface Class ==14
.................... 0x02, //subclass code, 2 = Abstract ==15
.................... 0x01, //protocol code, 1 = v.25ter ==16
.................... 0x00, //index of string descriptor for interface ==17
....................
.................... //class descriptor [functional header]
.................... 5, //length of descriptor ==18
.................... 0x24, //dscriptor type (0x24 == ) ==19
.................... 0, //sub type (0=functional header) ==20
.................... 0x10,0x01, // ==21,22 //cdc version
....................
.................... //class descriptor [acm header]
.................... 4, //length of descriptor ==23
.................... 0x24, //dscriptor type (0x24 == ) ==24
.................... 2, //sub type (2=ACM) ==25
.................... 2, //capabilities ==26 //we support Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State.
....................
.................... //class descriptor [union header]
.................... 5, //length of descriptor ==27
.................... 0x24, //dscriptor type (0x24 == ) ==28
.................... 6, //sub type (6=union) ==29
.................... 0, //master intf ==30 //The interface number of the Communication or Dat a Cl ass interface, designated as the masteror controlling interface for the union.
.................... 1, //save intf0 ==31 //Interface number of first slave or associated interface in the union. *
....................
.................... //class descriptor [call mgmt header]
.................... 5, //length of descriptor ==32
.................... 0x24, //dscriptor type (0x24 == ) ==33
.................... 1, //sub type (1=call mgmt) ==34
.................... 0, //capabilities ==35 //device does not handle call management itself
.................... 1, //data interface ==36 //interface number of data class interface
....................
.................... //endpoint descriptor
.................... USB_DESC_ENDPOINT_LEN, //length of descriptor ==37
.................... USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==38
.................... USB_CDC_COMM_IN_ENDPOINT | 0x80, //endpoint number and direction
.................... 0x03, //transfer type supported (0x03 is interrupt) ==40
.................... USB_CDC_COMM_IN_SIZE,0x00, //maximum packet size supported ==41,42
.................... 250, //polling interval, in ms. (interrupt endpoint cant be smaller than 10 for slow speed devices) ==43
....................
.................... //interface descriptor 1 (data class interface)
.................... USB_DESC_INTERFACE_LEN, //length of descriptor =44
.................... USB_DESC_INTERFACE_TYPE, //constant INTERFACE (INTERFACE 0x04) =45
.................... 0x01, //number defining this interface (IF we had more than one interface) ==46
.................... 0x00, //alternate setting ==47
.................... 2, //number of endpoints ==48
.................... 0x0A, //class code, 0A = Data Interface Class ==49
.................... 0x00, //subclass code ==50
.................... 0x00, //protocol code ==51
.................... 0x00, //index of string descriptor for interface ==52
....................
.................... //endpoint descriptor
.................... USB_DESC_ENDPOINT_LEN, //length of descriptor ==53
.................... USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==54
.................... USB_CDC_DATA_OUT_ENDPOINT, //endpoint number and direction (0x02 = EP2 OUT) ==55
.................... 0x02, //transfer type supported (0x02 is bulk) ==56
.................... (USB_CDC_DATA_OUT_SIZE+1) & 0xFF, ((USB_CDC_DATA_OUT_SIZE+1) >> 8) & 0xFF, //maximum packet size supported ==57, 58
.................... 1, //polling interval, in ms. ==59
....................
.................... //endpoint descriptor
.................... USB_DESC_ENDPOINT_LEN, //length of descriptor ==60
.................... USB_DESC_ENDPOINT_TYPE, //constant ENDPOINT (ENDPOINT 0x05) ==61
.................... USB_CDC_DATA_IN_ENDPOINT | 0x80, //endpoint number and direction (0x82 = EP2 IN) ==62
.................... 0x02, //transfer type supported (0x02 is bulk) ==63
.................... (USB_CDC_DATA_IN_SIZE+1) & 0xFF, ((USB_CDC_DATA_IN_SIZE+1) >> 8) & 0xFF, //maximum packet size supported ==66, 67
.................... 1, //polling interval, in ms. ==68
.................... };
....................
.................... //****** BEGIN CONFIG DESCRIPTOR LOOKUP TABLES ********
.................... //since we can't make pointers to constants in certain pic16s, this is an offset table to find
.................... // a specific descriptor in the above table.
....................
.................... //the maximum number of interfaces seen on any config
.................... //for example, if config 1 has 1 interface and config 2 has 2 interfaces you must define this as 2
.................... #define USB_MAX_NUM_INTERFACES 2
....................
.................... //define how many interfaces there are per config. [0] is the first config, etc.
.................... const char USB_NUM_INTERFACES[USB_NUM_CONFIGURATIONS]={2};
....................
.................... //define where to find class descriptors
.................... //first dimension is the config number
.................... //second dimension specifies which interface
.................... //last dimension specifies which class in this interface to get, but most will only have 1 class per interface
.................... //if a class descriptor is not valid, set the value to 0xFFFF
.................... const int8 USB_CLASS_DESCRIPTORS[USB_NUM_CONFIGURATIONS][USB_MAX_NUM_INTERFACES][4]=
.................... {
.................... //config 1
.................... //interface 0
.................... //class 1-4
.................... 18,23,27,32,
.................... //interface 1
.................... //no classes for this interface
.................... 0xFF,0xFF,0xFF,0xFF
.................... };
....................
.................... #if (sizeof(USB_CONFIG_DESC) != USB_TOTAL_CONFIG_LEN)
.................... #error USB_TOTAL_CONFIG_LEN not defined correctly
.................... #endif
....................
....................
.................... //////////////////////////////////////////////////////////////////
.................... ///
.................... /// start device descriptors
.................... ///
.................... //////////////////////////////////////////////////////////////////
....................
.................... const char USB_DEVICE_DESC[USB_DESC_DEVICE_LEN] ={
.................... //starts of with device configuration. only one possible
.................... USB_DESC_DEVICE_LEN, //the length of this report ==0
.................... 0x01, //the constant DEVICE (DEVICE 0x01) ==1
.................... 0x10,0x01, //usb version in bcd ==2,3
.................... 0x02, //class code. 0x02=Communication Device Class ==4
.................... 0x00, //subclass code ==5
.................... 0x00, //protocol code ==6
.................... USB_MAX_EP0_PACKET_LENGTH, //max packet size for endpoint 0. (SLOW SPEED SPECIFIES 8) ==7
.................... USB_CONFIG_VID & 0xFF, ((USB_CONFIG_VID >> 8) & 0xFF), //vendor id ==9, 10
.................... USB_CONFIG_PID & 0xFF, ((USB_CONFIG_PID >> 8) & 0xFF), //product id, don't use 0xffff ==11, 12
.................... USB_CONFIG_VERSION & 0xFF, ((USB_CONFIG_VERSION >> 8) & 0xFF), //device release number ==13,14
.................... 0x01, //index of string description of manufacturer. therefore we point to string_1 array (see below) ==14
.................... 0x02, //index of string descriptor of the product ==15
.................... 0x00, //index of string descriptor of serial number ==16
.................... USB_NUM_CONFIGURATIONS //number of possible configurations ==17
.................... };
....................
....................
.................... //////////////////////////////////////////////////////////////////
.................... ///
.................... /// start string descriptors
.................... /// String 0 is a special language string, and must be defined. People in U.S.A. can leave this alone.
.................... ///
.................... /// You must define the length else get_next_string_character() will not see the string
.................... /// Current code only supports 10 strings (0 thru 9)
.................... ///
.................... //////////////////////////////////////////////////////////////////
....................
.................... #if !defined(USB_STRINGS_OVERWRITTEN)
.................... //the offset of the starting location of each string. offset[0] is the start of string 0, offset[1] is the start of string 1, etc.
.................... char USB_STRING_DESC_OFFSET[]={0,4,12};
....................
.................... // Here is where the "CCS" Manufacturer string and "SERIAL DEMO" are stored.
.................... // Strings are saved as unicode.
.................... // These strings are mostly only displayed during the add hardware wizard.
.................... // Once the operating system drivers have been installed it will usually display
.................... // the name from the drivers .INF.
.................... char const USB_STRING_DESC[]={
.................... //string 0
.................... 4, //length of string index
.................... USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
.................... 0x09,0x04, //Microsoft Defined for US-English
.................... //string 1 - manufacturer
.................... 8, //length of string index
.................... USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
.................... 'C',0,
.................... 'C',0,
.................... 'S',0,
.................... //string 2 - product
.................... 24, //length of string index
.................... USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
.................... 'S',0,
.................... 'E',0,
.................... 'R',0,
.................... 'I',0,
.................... 'A',0,
.................... 'L',0,
.................... ' ',0,
.................... 'D',0,
.................... 'E',0,
.................... 'M',0,
.................... 'O',0
.................... };
.................... #endif //!defined(USB_STRINGS_OVERWRITTEN)
....................
.................... #ENDIF
....................
.................... #include <usb.c> //handles usb setup tokens and get descriptor reports
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// usb.c ////
.................... //// ////
.................... //// Standard USB request and token handler code. ////
.................... //// ////
.................... //// This file is part of CCS's PIC USB driver code. See USB.H ////
.................... //// for more documentation and a list of examples. ////
.................... //// ////
.................... //// The majority of this code is called and used by the interrupt ////
.................... //// generated by the hardware level, and therefore it is not meant ////
.................... //// to be called by the user. The functions that are meant to be ////
.................... //// called by the user (init, put packet, get packet, etc) are ////
.................... //// documented in USB.H. ////
.................... //// ////
.................... //// ************************* NOTE ************************** ////
.................... //// This code will not create a multiple configuration device. ////
.................... //// If you wish to create a multiple configuration device then you ////
.................... //// will have to modify these drivers. ////
.................... //// ////
.................... //// ************************* NOTE ************************** ////
.................... //// This code does not support Get_Idle or Set_Idle HID-specific ////
.................... //// requests. These requests are optional. If you want to support ////
.................... //// these requests you must provide the code yourself. See ////
.................... //// usb_isr_tkn_setup_ClassInterface() if you wish to add this ////
.................... //// support. ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// If you wish to provide your own USB peripheral hardware layer, it ////
.................... //// must must provide the API as described in usb_hw_layer.h. ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// Version History: ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... //// Dec 14, 2007: ////
.................... //// usb_kbhit() moved to device driver. ////
.................... //// ////
.................... //// July 13th, 2005: ////
.................... //// usb_puts() packet_size and this_packet_len changed to 16bits. ////
.................... //// usb_gets() len, packet_size and this_packet_len to 16bits. ////
.................... //// ////
.................... //// June 20th, 2005: ////
.................... //// Initial 18fxx5x release. ////
.................... //// usb_kbhit() removed, usb_kbhit() now implemented in hardware ////
.................... //// layer. ////
.................... //// ////
.................... //// May 13th, 2005: ////
.................... //// Beta release, only works with 18Fxx5x hardware layer. ////
.................... //// Now supports multiple interfaces (many defines in descriptors ////
.................... //// will have to be changed, see examples) ////
.................... //// TODO: alot of indexing and length handling for descriptors is ////
.................... //// only 8bit, so make sure all descriptor tables are less than ////
.................... //// 256 bytes long. ////
.................... //// ////
.................... //// Apr 21st, 2005: ////
.................... //// Initial Alpha Release with PIC18Fxx5x support. (ONLY TESTED ////
.................... //// WITH 18F4550) ////
.................... //// usb_puts() doesn't need max packet size as a paremeter, uses ////
.................... //// usb_ep_tx_size[] defined in usb.h ////
.................... //// usb_puts() timeout parameter now in ms, not seconds. ////
.................... //// USB Stack no longer buffers incoming data. If there is data to ////
.................... //// get usb_kbhit(en) will return TRUE and the data will sit in ////
.................... //// the endpoint buffer until you usb_get_packet(), which will ////
.................... //// then free the endpoint buffer for more data. This affects ////
.................... //// routines such as usb_gets() and usb_kbhit(). ////
.................... //// usb_gets() no longer reads buffered data (see above note), ////
.................... //// now it reads multiple packets in the same way usb_puts() ////
.................... //// writes multiple packets ////
.................... //// usb_kbhit() is hardware specific, so has been moved to hardware ////
.................... //// layer. ////
.................... //// ////
.................... //// Nov 11th, 2004: ////
.................... //// No longer includes wrong descriptor header. ////
.................... //// ////
.................... //// June 24th, 2004: ////
.................... //// Optimization and cleanup. ////
.................... //// The following definitions changed: ////
.................... //// USB_EPx_TX_ENABLE and USB_EPx_RX_ENABLE have changed. See usb.h ////
.................... //// USB_CONFIG_DESCRIPTORS[] removed ////
.................... //// USB_CONFIG_DESC_LEN changed to USB_DESC_CONFIG_LEN ////
.................... //// USB_INTERFACE_DESC_LEN changed to USB_DESC_INTERFACE_LEN ////
.................... //// USB_CLASS_DESC_LEN changed to USB_DESC_CLASS_LEN ////
.................... //// USB_ENDPOINT_DESC_LEN changed to USB_DESC_ENDPOINT_LEN ////
.................... //// USB_CONFIG_DESC_KEY changed to USB_DESC_CONFIG_TYPE ////
.................... //// USB_INTERFACE_DESC_KEY changed to USB_DESC_INTERFACE_TYPE ////
.................... //// USB_CLASS_DESC_KEY changed to USB_DESC_CLASS_TYPE ////
.................... //// USB_ENDPOINT_DESC_KEY changed to USB_DESC_ENDPOINT_TYPE ////
.................... //// USB_STRING_X[] arrays removed, see USB_STRING_DESC[] and ////
.................... //// USB_STRING_DESC_OFFSET[] ////
.................... //// dev_req, curr_config, status_device and getdesc_type global ////
.................... //// variables moved into struct USB_stack_status ////
.................... //// ////
.................... //// December 5th, 2003: Fixed a potential bug where descriptors are ////
.................... //// evenly dividable by 8 (MAX_EP0_PACKET_SIZE) ////
.................... //// ////
.................... //// October 15th, 2003: Support for boot protocol added. ////
.................... //// Set USB_HID_BOOT_PROTOCOL to TRUE to support this. ////
.................... //// The array hid_protocol[] saves which protocol mode each ////
.................... //// interface is in. It is your applications job to send ////
.................... //// data that either fit the boot protocol or HID protocol. ////
.................... //// ////
.................... //// May 6th, 2003: Fixed a potential stack overflow using PCM ////
.................... //// ////
.................... //// October 28th, 2002: Problem with usb_puts and timeout fixed. ////
.................... //// ////
.................... //// October 28th, 2002: Typo fixed in get_next_string_character(), ////
.................... //// although it didn't cause any serious problems ////
.................... //// ////
.................... //// October 25th, 2002: Another change to usb_puts() was made to fix ////
.................... //// problems with multiple packet messages ////
.................... //// October 29th, 2002: Fixed a problem with multiple packet string ////
.................... //// descriptors that require a 0 len packet to ////
.................... //// end message. ////
.................... //// ////
.................... //// October 23rd, 2002: usb_puts() will bomb out of error quicker ////
.................... //// ////
.................... //// August 2nd, 2002: Initial Public Release ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2005 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #IFNDEF __USB_DRIVER__
.................... #DEFINE __USB_DRIVER__
....................
.................... #include <usb.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// usb.h ////
.................... //// ////
.................... //// Function protypes, defintions and globals used by CCS USB driver ////
.................... //// ////
.................... //// This file is part of CCS's USB driver code ////
.................... //// ////
.................... //// The following USB examples are provided by CCS: ////
.................... //// ex_usb_mouse.c - A HID Mouse. ////
.................... //// ex_usb_hid.c - A custom application using HID protocol. ////
.................... //// ex_usb_kbmouse.c - A HID Mouse/Keyboard combo using multiple ////
.................... //// interfaces. ////
.................... //// ex_usb_kbmouse2.c - A HID Mouse/Keyboard combo using multiple ////
.................... //// HID Reports. ////
.................... //// ex_usb_scope.c - A digital oscilloscope using a custom ////
.................... //// protocol requiring custom Windows drivers. ////
.................... //// ex_usb_serial.c - ////
.................... //// ex_usb_serial2.c - Two examples of using the CDC driver for ////
.................... //// a virtual COM port. ////
.................... //// ex_usb_bootloader.c - CDC/Virtual COM port bootloader. ////
.................... //// ex_usb_loadmouse.c - A conversion of ex_usb_mouse.c that is ////
.................... //// compatible with ex_usb_mouse.c. ////
.................... //// ////
.................... //// ********************** API ********************* ////
.................... //// ////
.................... //// These are the functions that are meant to be called by the user: ////
.................... //// ////
.................... //// usb_init() - Initializes the USB stack, the USB peripheral and ////
.................... //// attaches the unit to the usb bus. Enables ////
.................... //// interrupts. Will wait in an infinite loop until ////
.................... //// the device enumerates - if you are using ////
.................... //// connection sense or if the processor should run ////
.................... //// even if it's not connected to USB then use ////
.................... //// usb_init_cs() instead. ////
.................... //// ////
.................... //// usb_init_cs() - A smaller usb_init(), does not attach unit ////
.................... //// to usb bus or enable interrupts. Since this does ////
.................... //// not attach to the USB, you must periodically call ////
.................... //// usb_task(). See usb_task() for more information. ////
.................... //// ////
.................... //// usb_task() - If usb_init_cs() was used to initiate the USB ////
.................... //// peripheral, usb_task() should then be called periodically ////
.................... //// to check the connection sense pin. If the connection ////
.................... //// sense pin denotes USB is connected and the USB peripheral ////
.................... //// is not attached, this will attach the USB peripheral ////
.................... //// so the PC can start the enumeration process (and it ////
.................... //// will enable interrupts). If the connection sense pin ////
.................... //// denotes USB is not attached and the USB peripheral is ////
.................... //// running, this will reset the USB peripheral and wait ////
.................... //// for USB to reconnect (and usb_enumerated() will start ////
.................... //// returning FALSE). If connection sense (USB_CON_SENSE_PIN) ////
.................... //// is not defined the usb_task() assumes that USB is always ////
.................... //// connected. ////
.................... //// ////
.................... //// usb_attached() - Returns TRUE if the device is attached to a ////
.................... //// USB cable. A macro that looks at the defined ////
.................... //// connection sense pin. If this returns TRUE ////
.................... //// it does not mean the PC has connected to it, ////
.................... //// you need to use usb_enumerated() to check this. ////
.................... //// ////
.................... //// usb_enumerated() - Returns TRUE if device has been enumerated ////
.................... //// (configured) by host, FALSE if it has not. ////
.................... //// Do not try to use the USB peripheral for ////
.................... //// sending and receiving packets until you ////
.................... //// are enumerated. ////
.................... //// ////
.................... //// usb_wait_for_enumeration() - Sits in an infinte loop until device ////
.................... //// is enumerated. ////
.................... //// ////
.................... //// usb_tbe(endpoint) - Returns TRUE if the endpoint transmit buffer ////
.................... //// is free and ready to accept a new packet for transmission. ////
.................... //// ////
.................... //// usb_put_packet(endpoint, ptr, len, tgl) - Sends one packet to the ////
.................... //// host. If you need to send a message that ////
.................... //// spans more than one packet then use ////
.................... //// usb_puts(). Fore more detailed documentation ////
.................... //// see usb_hw_layer.h ////
.................... //// ////
.................... //// usb_puts(endpoint, ptr, len, timeout) - Sends a multiple packet ////
.................... //// message to the host. If you only need to send one packet, ////
.................... //// it is more effecient to use usb_put_packet(). This is ////
.................... //// documented in more detail above the prototype in USB.H. ////
.................... //// ////
.................... //// usb_kbhit(endpoint) - Returns true if OUT endpoint contains data ////
.................... //// from host. This will remain TRUE until ////
.................... //// usb_put_packet() or usb_flush_out() used. ////
.................... //// This function will return an invalid response ////
.................... //// if specified endpoint is not enabled for ////
.................... //// receiving data. ////
.................... //// ////
.................... //// len = usb_get_packet(endpoint, ptr, max) - Gets one packet that ////
.................... //// from the host/PC. usb_kbhit() must return TRUE before you ////
.................... //// call this routine or your data may not be valid. This ////
.................... //// only receives one packet, if you are trying to receive a ////
.................... //// multi-packet message use usb_gets(). For more detailed ////
.................... //// documentation see usb_hw_layer.h. ////
.................... //// ////
.................... //// len = usb_gets(endpoint, ptr, max, timeout) - Gets multiple ////
.................... //// packets from the host, you would use this instead ////
.................... //// of usb_get_packet() if you wanted to handle multi-packet ////
.................... //// messages. This is documented in more detail above the ////
.................... //// prototype in USB.H. ////
.................... //// ////
.................... //// ////
.................... //// ********* DEFINITIONS / CONFIGURATION ********** ////
.................... //// ////
.................... //// The following definitions are declared here, but can be ////
.................... //// overwritten in your code. Unless needed otherwise, leave ////
.................... //// to default value. If confused about a definition read the ////
.................... //// comments at each defintion ////
.................... //// ////
.................... //// USB_HID_IDLE (TRUE) - Set to TRUE if your device supports ////
.................... //// Set_Idle HID class request. Set to ////
.................... //// False if you do not (device will ////
.................... //// send a Wrong-state if computer ////
.................... //// sends a Set_Idle / Get_Idle command) ////
.................... //// NOTE: If you set to TRUE you must ////
.................... //// provide your own code. See ////
.................... //// usb_isr_tkn_setup_ClassInterface() in ////
.................... //// usb.c ////
.................... //// ////
.................... //// USB_HID_BOOT_PROTOCOL (FALSE) - Set to TRUE if your device supports ////
.................... //// Set_Protocl HID class request. Set to ////
.................... //// False if you do not (device will ////
.................... //// send a Wrong-state if computer ////
.................... //// sends a Set_Protocl / Get_Protocol ////
.................... //// command). ////
.................... //// NOTE: If you set to TRUE you must ////
.................... //// provide your own code in the ////
.................... //// application that properly send boot ////
.................... //// or HID packets. ////
.................... //// ////
.................... //// USB_MAX_EP0_PACKET_LENGTH (8) - Max Packet size for Endpoint 0. ////
.................... //// The hardware level driver (ex ////
.................... //// pic18_usb.h will define this value if ////
.................... //// not already overwritten). Increasing ////
.................... //// this size will speed up the ////
.................... //// enumeration process. ////
.................... //// ////
.................... //// USB_EPx_RX_ENABLE (USB_ENABLE_DISABLED) - Where x is the ////
.................... //// endpoint number. Change this define ////
.................... //// to specify what kind of transfer method ////
.................... //// this RX (PC to device) endpoint uses. ////
.................... //// Here is the list of valid transfer methods: ////
.................... //// USB_ENABLE_CONTROL ////
.................... //// USB_ENABLE_ISOCHRONOUS ////
.................... //// USB_ENABLE_BULK ////
.................... //// USB_ENABLE_INTERRUPT ////
.................... //// USB_ENABLE_DISABLED ////
.................... //// Don't forget that you must specify the ////
.................... //// transfer method properly in your endpoint ////
.................... //// descriptor, too. ////
.................... //// ////
.................... //// USB_EPx_RX_SIZE (0) - For some hardware it is important to know ////
.................... //// how much memory to reserve for receiving ////
.................... //// packets. ////
.................... //// ////
.................... //// *** NOTE *** You must have both USB_EPx_RX_ENABLE defined and ////
.................... //// USB_EPx_RX_SIZE defined (non 0) to enable a RX ////
.................... //// endpoint. ////
.................... //// *** NOTE *** Endpoint 0 is always enabled. ////
.................... //// ////
.................... //// USB_EPx_TX_ENABLE (USB_ENABLE_DISABLED) - Where x is the ////
.................... //// endpoint number. Change this define ////
.................... //// to specify what kind of transfer method ////
.................... //// this TX (device to PC) endpoint uses. ////
.................... //// Here is the list of valid transfer methods: ////
.................... //// USB_ENABLE_CONTROL ////
.................... //// USB_ENABLE_ISOCHRONOUS ////
.................... //// USB_ENABLE_BULK ////
.................... //// USB_ENABLE_INTERRUPT ////
.................... //// USB_ENABLE_DISABLED ////
.................... //// Don't forget that you must specify the ////
.................... //// transfer method properly in your endpoint ////
.................... //// descriptor, too. ////
.................... //// ////
.................... //// USB_EPx_TX_SIZE (0) - For some hardware it is important to know ////
.................... //// how much memory to reserve for transmitting ////
.................... //// packets. ////
.................... //// ////
.................... //// *** NOTE *** You must have both USB_EPx_TX_ENABLE defined and ////
.................... //// USB_EPx_TX_SIZE defined (non 0) to enable a TX ////
.................... //// endpoint. ////
.................... //// ////
.................... //// ////
.................... //// USB_HID_DEVICE (TRUE) - HID devices require extra code to handle ////
.................... //// HID requests. You can disable to save ////
.................... //// ROM space if you are not using a HID ////
.................... //// device. If you are not using a HID ////
.................... //// device you must provide your own O/S ////
.................... //// (Windows) driver. ////
.................... //// ////
.................... //// The other definitions should not be changed. ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// Version History: ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... //// July 13th, 2005: ////
.................... //// usb_ep_tx_size[] and usb_ep_rx_size[] changed to 16bits ////
.................... //// ////
.................... //// June 20th, 2005: ////
.................... //// Initial 18fxx5x release ////
.................... //// ////
.................... //// May 13th, 2005: ////
.................... //// Beta release, only works with 18Fxx5x hardware layer. ////
.................... //// Now supports multiple interfaces (many defines in descriptors ////
.................... //// will have to be changed, see examples) ////
.................... //// ////
.................... //// Mar 21st, 2005: ////
.................... //// Initial Alpha Release with PIC18Fxx5x support. (ONLY TESTED ////
.................... //// WITH 18F4550) ////
.................... //// usb_gets() and usb_puts() changed (see usb.c) ////
.................... //// ////
.................... //// June 24th, 2004: ////
.................... //// Optimization and cleanup. ////
.................... //// The following definitions changed: ////
.................... //// USB_EPx_TX_ENABLE and USB_EPx_RX_ENABLE have changed. See usb.h ////
.................... //// USB_CONFIG_DESCRIPTORS[] removed ////
.................... //// USB_CONFIG_DESC_LEN changed to USB_DESC_CONFIG_LEN ////
.................... //// USB_INTERFACE_DESC_LEN changed to USB_DESC_INTERFACE_LEN ////
.................... //// USB_CLASS_DESC_LEN changed to USB_DESC_CLASS_LEN ////
.................... //// USB_ENDPOINT_DESC_LEN changed to USB_DESC_ENDPOINT_LEN ////
.................... //// USB_CONFIG_DESC_KEY changed to USB_DESC_CONFIG_TYPE ////
.................... //// USB_INTERFACE_DESC_KEY changed to USB_DESC_INTERFACE_TYPE ////
.................... //// USB_CLASS_DESC_KEY changed to USB_DESC_CLASS_TYPE ////
.................... //// USB_ENDPOINT_DESC_KEY changed to USB_DESC_ENDPOINT_TYPE ////
.................... //// USB_STRING_X[] arrays removed, see USB_STRING_DESC[] and ////
.................... //// USB_STRING_DESC_OFFSET[] ////
.................... //// dev_req, curr_config, status_device and getdesc_type global ////
.................... //// variables moved into struct USB_stack_status ////
.................... //// ////
.................... //// October 15th, 2003: Support for boot protocol added. ////
.................... //// Set USB_HID_BOOT_PROTOCOL to TRUE to support this. ////
.................... //// The array hid_protocol[] saves which protocol mode each ////
.................... //// interface is in. It is your applications job to send ////
.................... //// data that either fit the boot protocol or HID protocol. ////
.................... //// ////
.................... //// May 6th, 2003: Fixed a potential stack overflow using PCM ////
.................... //// ////
.................... //// October 29th, 2002: New definition added to USB_STATES ////
.................... //// ////
.................... //// August 2nd, 2002: Initial Public Release ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2009 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #IFNDEF __USB_PROTOTYPES__
.................... #DEFINE __USB_PROTOTYPES__
....................
.................... //// CONFIGURATION ////////////////////////////////////////////////////////////
....................
.................... #ifndef USB_CON_SENSE_PIN
.................... #define USB_CON_SENSE_PIN 0
.................... #endif
....................
.................... #IFNDEF USB_HID_BOOT_PROTOCOL
.................... #DEFINE USB_HID_BOOT_PROTOCOL FALSE
.................... #ENDIF
....................
.................... #IFNDEF USB_HID_IDLE
.................... #DEFINE USB_HID_IDLE FALSE
.................... #ENDIF
....................
.................... //should the compiler add the extra HID handler code? Defaults to yes.
.................... #IFNDEF USB_HID_DEVICE
.................... #DEFINE USB_HID_DEVICE TRUE
.................... #ENDIF
....................
.................... #IFNDEF USB_CDC_DEVICE
.................... #DEFINE USB_CDC_DEVICE FALSE
.................... #ENDIF
....................
.................... //set to false to opt for less RAM, true to opt for less ROM
.................... #ifndef USB_OPT_FOR_ROM
.................... #define USB_OPT_FOR_ROM TRUE
.................... #endif
....................
.................... #IFNDEF USB_MAX_EP0_PACKET_LENGTH
.................... #DEFINE USB_MAX_EP0_PACKET_LENGTH 8
.................... #ENDIF
....................
....................
.................... ////// USER-LEVEL API /////////////////////////////////////////////////////////
....................
.................... /**************************************************************
.................... /* usb_enumerated()
.................... /*
.................... /* Input: Global variable USB_Curr_Config
.................... /* Returns: Returns a 1 if device is configured / enumerated,
.................... /* Returns a 0 if device is un-configured / not enumerated.
.................... /*
.................... /* Summary: See API section of USB.H for more documentation.
.................... /***************************************************************/
.................... int1 usb_enumerated(void);
....................
.................... /**************************************************************
.................... /* usb_wait_for_enumeration()
.................... /*
.................... /* Input: Global variable USB_Curr_Config
.................... /*
.................... /* Summary: Waits in-definately until device is configured / enumerated.
.................... /* See API section of USB.H for more information.
.................... /***************************************************************/
.................... void usb_wait_for_enumeration(void);
....................
.................... /****************************************************************************
.................... /* usb_gets(endpoint, ptr, max, timeout)
.................... /*
.................... /* Input: endpoint - endpoint to get data from
.................... /* ptr - place / array to store data to
.................... /* max - max amount of data to get from USB and store into ptr
.................... /* timeout - time in milliseconds, for each packet, to wait before
.................... /* timeout. set to 0 for no timeout.
.................... /*
.................... /* Output: Amount of data returned. It may be less than max.
.................... /*
.................... /* Summary: Gets data from the host. Will get multiple-packet messages
.................... /* and finish when either it receives a 0-len packet or a packet
.................... /* of less size than maximum.
.................... /*
.................... /*****************************************************************************/
.................... unsigned int16 usb_gets(int8 endpoint, int8 * ptr, unsigned int16 max, unsigned int16 timeout);
....................
.................... /****************************************************************************
.................... /* usb_puts()
.................... /*
.................... /* Inputs: endpoint - endpoint to send data out
.................... /* ptr - points to array of data to send
.................... /* len - amount of data to send
.................... /* timeout - time in milli-seconds, for each packet, to wait before
.................... /* timeout. set to 0 for no timeout.
.................... /*
.................... /* Outputs: Returns TRUE if message sent succesfully, FALSE if it was not
.................... /* sent before timeout period expired.
.................... /*
.................... /* Summary: Used for sending multiple packets of data as one message. This
.................... /* function can still be used to send messages consiting of only one
.................... /* packet. See usb_put_packet() documentation for the rules about when
.................... /* multiple packet messages or 0-lenght packets are needed.
.................... /*
.................... /*****************************************************************************/
.................... int1 usb_puts(int8 endpoint, int8 * ptr, unsigned int16 len, unsigned int8 timeout);
....................
.................... /******************************************************************************
.................... /* usb_attached()
.................... /*
.................... /* Summary: Returns TRUE if the device is attached to a USB cable.
.................... /* See the API section of USB.H for more documentation.
.................... /*
.................... /*****************************************************************************/
.................... #if USB_CON_SENSE_PIN
.................... #define usb_attached() input(USB_CON_SENSE_PIN)
.................... #else
.................... #define usb_attached() TRUE
.................... #endif
....................
.................... ////// END USER-LEVEL API /////////////////////////////////////////////////////
....................
....................
.................... ////// STACK-LEVEL API USED BY HW DRIVERS ////////////////////////////////////
....................
.................... enum USB_STATES {GET_DESCRIPTOR=1,SET_ADDRESS=2,NONE=0};
....................
.................... enum USB_GETDESC_TYPES {USB_GETDESC_CONFIG_TYPE=0,USB_GETDESC_HIDREPORT_TYPE=1,USB_GETDESC_STRING_TYPE=2,USB_GETDESC_DEVICE_TYPE=3};
....................
.................... #if USB_OPT_FOR_ROM
.................... typedef struct {
.................... USB_STATES dev_req; //what did the last setup token set us up to do?. init at none
.................... int curr_config; //our current config. start at none/powered (NOT THAT THIS LIMITS US TO 3 CONFIGURATIONS)
.................... int status_device; //Holds our state for Set_Feature and Clear_Feature
.................... USB_GETDESC_TYPES getdesc_type; //which get_descriptor() we are handling
.................... } TYPE_USB_STACK_STATUS;
.................... #else
.................... typedef struct {
.................... USB_STATES dev_req:2; //what did the last setup token set us up to do?. init at none
.................... int Curr_config:2; //our current config. start at none/powered (NOT THAT THIS LIMITS US TO 3 CONFIGURATIONS)
.................... int status_device:2; //Holds our state for Set_Feature and Clear_Feature
.................... USB_GETDESC_TYPES getdesc_type:2; //which get_descriptor() we are handling
.................... } TYPE_USB_STACK_STATUS;
.................... #endif
....................
.................... extern TYPE_USB_STACK_STATUS USB_stack_status;
....................
.................... /**************************************************************
.................... /* usb_token_reset()
.................... /*
.................... /* Output: No output (but many global registers are modified)
.................... /*
.................... /* Summary: Resets the token handler to initial (unconfigured) state.
.................... /***************************************************************/
.................... void usb_token_reset(void);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_setup_dne()
.................... /*
.................... /* Input: usb_ep0_rx_buffer[] contains the the setup packet.
.................... /*
.................... /* Output: None (many globals are changed)
.................... /*
.................... /* Summary: This function is that handles the setup token.
.................... /* We must handle all relevant requests, such as Set_Configuration,
.................... /* Get_Descriptor, etc.
.................... /*
.................... /* usb_ep0_rx_buffer[] contains setup data packet, which has the
.................... /* following records:
.................... /* -------------------------------------------------------------------------------------------
.................... /* usb_ep0_rx_buffer[ 0 ]=bmRequestType; Where the setup packet goes
.................... /* bit7 (0) host-to-device
.................... /* (1) device-to-host
.................... /* bit6-5 (00) usb standard request;
.................... /* (01) class request;
.................... /* (10) vendor request
.................... /* (11) reserved
.................... /* bit4-0 (0000) device
.................... /* (0001) interface
.................... /* (0010) endpoint
.................... /* (0011) other element
.................... /* (0100) to (1111) reserved
.................... /* usb_ep0_rx_buffer[ 1 ]=bRequest ; the request
.................... /* usb_ep0_rx_buffer[2,3]=wValue ; a value which corresponds to request
.................... /* usb_ep0_rx_buffer[4,5]=wIndex ; could correspond to interface or endpoint...
.................... /* usb_ep0_rx_buffer[6,7]=wLength ; number of bytes in next data packet;
.................... /* for host-to-device, this exactly how many bytes in data packet.
.................... /* for device-to-host, this is the maximum bytes that can fit one packet.
.................... /***************************************************************/
.................... void usb_isr_tok_setup_dne(void);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_out_dne()
.................... /*
.................... /* Input: endpoint contains which endpoint we are receiving data (0..15)
.................... /*
.................... /* Summary: Processes out tokens (out is respective of the host, so actualy
.................... /* incoming to the pic), but not out setup tokens. Normally when
.................... /* data is received it is left in the buffer (user would use
.................... /* usb_kbhit() and usb_get_packet() to receive data), but certain
.................... /* libraries (like CDC) have to answer setup packets.
.................... /*
.................... /***************************************************************/
.................... void usb_isr_tok_out_dne(int8 endpoint);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_in_dne(endpoint)
.................... /*
.................... /* Input: endpoint - which endpoint we are processing a setup token.
.................... /*
.................... /* Summary: This handles an IN packet (HOST <- PIC). For endpoint 0, this
.................... /* is usually to setup a response packet to a setup packet. Endpoints 1..15
.................... /* are generally ignored, and the user has to use usb_tbe() to determine if
.................... /* if the buffer is ready for a new transmit packet (there are special cases,
.................... /* like CDC which handles the CDC protocl).
.................... /*
.................... /***************************************************************/
.................... void usb_isr_tok_in_dne(int8 endpoint);
....................
.................... ////// END STACK-LEVEL API USED BY HW DRIVERS /////////////////////////////////
....................
....................
.................... //CCS only supports one configuration at this time
.................... #DEFINE USB_NUM_CONFIGURATIONS 1 //DO NOT CHANGE
....................
.................... //PID values for tokens (see page 48 of USB Complete ed.1)
.................... #define PID_IN 0x09 //device to host transactions
.................... #define PID_OUT 0x01 //host to device transactions
.................... #define PID_SETUP 0x0D //host to device setup transaction
.................... #define PID_ACK 0x02 //receiver accepts error-free data packet
.................... #define PID_DATA0 0x03 //data packet with even sync bit
.................... #define PID_SOF 0x05 //start of framer marker and frame number
.................... #define PID_NAK 0x0A //receiver can't accept data or sender cant send data or has no data to transmit
.................... #define PID_DATA1 0x0B //data packet with odd sync bit
.................... #define PID_PRE 0x0C //preamble issued by host. enables downstream traffic to low-speed device
.................... #define PID_STALL 0x0E //a control request isnt supported or the endpoint is halted
....................
.................... //Key which identifies descritpors
.................... #DEFINE USB_DESC_DEVICE_TYPE 0x01 //#DEFINE USB_DEVICE_DESC_KEY 0x01
.................... #DEFINE USB_DESC_CONFIG_TYPE 0x02 //#DEFINE USB_CONFIG_DESC_KEY 0x02
.................... #DEFINE USB_DESC_STRING_TYPE 0x03 //#DEFINE USB_STRING_DESC_KEY 0x03
.................... #DEFINE USB_DESC_INTERFACE_TYPE 0x04 //#DEFINE USB_INTERFACE_DESC_KEY 0x04
.................... #DEFINE USB_DESC_ENDPOINT_TYPE 0x05 //#DEFINE USB_ENDPOINT_DESC_KEY 0x05
.................... #DEFINE USB_DESC_CLASS_TYPE 0x21 //#DEFINE USB_CLASS_DESC_KEY 0x21
.................... #DEFINE USB_DESC_HIDREPORT_TYPE 0x22
....................
.................... //The length of each descriptor
.................... #DEFINE USB_DESC_DEVICE_LEN 18 //#DEFINE USB_DEVICE_DESC_LEN 18
.................... #DEFINE USB_DESC_CONFIG_LEN 9 //#DEFINE USB_CONFIG_DESC_LEN 9
.................... #DEFINE USB_DESC_INTERFACE_LEN 9 //#DEFINE USB_INTERFACE_DESC_LEN 9
.................... #DEFINE USB_DESC_CLASS_LEN 9 //#DEFINE USB_CLASS_DESC_LEN 9
.................... #DEFINE USB_DESC_ENDPOINT_LEN 7 //#DEFINE USB_ENDPOINT_DESC_LEN 7
....................
.................... //Standard USB Setup bRequest Codes
.................... #define USB_STANDARD_REQUEST_GET_STATUS 0x00
.................... #define USB_STANDARD_REQUEST_CLEAR_FEATURE 0x01
.................... #define USB_STANDARD_REQUEST_SET_FEATURE 0x03
.................... #define USB_STANDARD_REQUEST_SET_ADDRESS 0x05
.................... #define USB_STANDARD_REQUEST_GET_DESCRIPTOR 0x06
.................... #define USB_STANDARD_REQUEST_SET_DESCRIPTOR 0x07
.................... #define USB_STANDARD_REQUEST_GET_CONFIGURATION 0x08
.................... #define USB_STANDARD_REQUEST_SET_CONFIGURATION 0x09
.................... #define USB_STANDARD_REQUEST_GET_INTERFACE 0x0A
.................... #define USB_STANDARD_REQUEST_SET_INTERFACE 0x0B
.................... #define USB_STANDARD_REQUEST_SYNCH_FRAME 0x0C
....................
.................... //HID Class Setup bRequest Codes
.................... #define USB_HID_REQUEST_GET_REPORT 0x01
.................... #define USB_HID_REQUEST_GET_IDLE 0x02
.................... #define USB_HID_REQUEST_GET_PROTOCOL 0x03
.................... #define USB_HID_REQUEST_SET_REPORT 0x09
.................... #define USB_HID_REQUEST_SET_IDLE 0x0A
.................... #define USB_HID_REQUEST_SET_PROTOCOL 0x0B
....................
.................... //types of endpoints as defined in the descriptor
.................... #define USB_ENDPOINT_TYPE_CONTROL 0x00
.................... #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
.................... #define USB_ENDPOINT_TYPE_BULK 0x02
.................... #define USB_ENDPOINT_TYPE_INTERRUPT 0x03
....................
.................... //types of endpoints used internally in this api
.................... #define USB_ENABLE_DISABLED -1
.................... #define USB_ENABLE_BULK USB_ENDPOINT_TYPE_BULK
.................... #define USB_ENABLE_ISOCHRONOUS USB_ENDPOINT_TYPE_ISOCHRONOUS
.................... #define USB_ENABLE_INTERRUPT USB_ENDPOINT_TYPE_INTERRUPT
.................... #define USB_ENABLE_CONTROL USB_ENDPOINT_TYPE_CONTROL
....................
....................
.................... //*** ENABLE RX ENDPOINTS AND BUFFERS
....................
.................... //--------- endpoint 0 defines ----------
.................... #define USB_EP0_TX_ENABLE USB_ENABLE_CONTROL
.................... #define USB_EP0_RX_ENABLE USB_ENABLE_CONTROL
.................... #define USB_EP0_RX_SIZE USB_MAX_EP0_PACKET_LENGTH //endpoint 0 is setup, and should always be the MAX_PACKET_LENGTH. Slow speed specifies 8
.................... #define USB_EP0_TX_SIZE USB_MAX_EP0_PACKET_LENGTH //endpoint 0 is setup, and should always be the MAX_PACKET_LENGTH. Slow speed specifies 8
....................
.................... //--------- endpoint 1 defines ----------
.................... #ifndef USB_EP1_TX_ENABLE
.................... #define USB_EP1_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP1_RX_ENABLE
.................... #define USB_EP1_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP1_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP1_RX_SIZE
.................... #undef USB_EP1_RX_SIZE
.................... #endif
.................... #define USB_EP1_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP1_RX_SIZE
.................... #error You enabled EP1 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP1_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP1_TX_SIZE
.................... #undef USB_EP1_TX_SIZE
.................... #endif
.................... #define USB_EP1_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP1_TX_SIZE
.................... #error You enabled EP1 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 2 defines ----------
.................... #ifndef USB_EP2_TX_ENABLE
.................... #define USB_EP2_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP2_RX_ENABLE
.................... #define USB_EP2_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP2_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP2_RX_SIZE
.................... #undef USB_EP2_RX_SIZE
.................... #endif
.................... #define USB_EP2_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP2_RX_SIZE
.................... #error You enabled EP2 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP2_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP2_TX_SIZE
.................... #undef USB_EP2_TX_SIZE
.................... #endif
.................... #define USB_EP2_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP2_TX_SIZE
.................... #error You enabled EP2 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 3 defines ----------
.................... #ifndef USB_EP3_TX_ENABLE
.................... #define USB_EP3_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP3_RX_ENABLE
.................... #define USB_EP3_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP3_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP3_RX_SIZE
.................... #undef USB_EP3_RX_SIZE
.................... #endif
.................... #define USB_EP3_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP3_RX_SIZE
.................... #error You enabled EP3 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP3_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP3_TX_SIZE
.................... #undef USB_EP3_TX_SIZE
.................... #endif
.................... #define USB_EP3_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP3_TX_SIZE
.................... #error You enabled EP3 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 4 defines ----------
.................... #ifndef USB_EP4_TX_ENABLE
.................... #define USB_EP4_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP4_RX_ENABLE
.................... #define USB_EP4_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP4_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP4_RX_SIZE
.................... #undef USB_EP4_RX_SIZE
.................... #endif
.................... #define USB_EP4_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP4_RX_SIZE
.................... #error You enabled EP4 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP4_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP4_TX_SIZE
.................... #undef USB_EP4_TX_SIZE
.................... #endif
.................... #define USB_EP4_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP4_TX_SIZE
.................... #error You enabled EP4 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 5 defines ----------
.................... #ifndef USB_EP5_TX_ENABLE
.................... #define USB_EP5_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP5_RX_ENABLE
.................... #define USB_EP5_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP5_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP5_RX_SIZE
.................... #undef USB_EP5_RX_SIZE
.................... #endif
.................... #define USB_EP5_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP5_RX_SIZE
.................... #error You enabled EP5 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP5_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP5_TX_SIZE
.................... #undef USB_EP5_TX_SIZE
.................... #endif
.................... #define USB_EP5_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP5_TX_SIZE
.................... #error You enabled EP5 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 6 defines ----------
.................... #ifndef USB_EP6_TX_ENABLE
.................... #define USB_EP6_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP6_RX_ENABLE
.................... #define USB_EP6_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP6_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP6_RX_SIZE
.................... #undef USB_EP6_RX_SIZE
.................... #endif
.................... #define USB_EP6_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP6_RX_SIZE
.................... #error You enabled EP6 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP6_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP6_TX_SIZE
.................... #undef USB_EP6_TX_SIZE
.................... #endif
.................... #define USB_EP6_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP6_TX_SIZE
.................... #error You enabled EP6 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 7 defines ----------
.................... #ifndef USB_EP7_TX_ENABLE
.................... #define USB_EP7_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP7_RX_ENABLE
.................... #define USB_EP7_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP7_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP7_RX_SIZE
.................... #undef USB_EP7_RX_SIZE
.................... #endif
.................... #define USB_EP7_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP7_RX_SIZE
.................... #error You enabled EP7 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP7_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP7_TX_SIZE
.................... #undef USB_EP7_TX_SIZE
.................... #endif
.................... #define USB_EP7_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP7_TX_SIZE
.................... #error You enabled EP7 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 8 defines ----------
.................... #ifndef USB_EP8_TX_ENABLE
.................... #define USB_EP8_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP8_RX_ENABLE
.................... #define USB_EP8_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP8_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP8_RX_SIZE
.................... #undef USB_EP8_RX_SIZE
.................... #endif
.................... #define USB_EP8_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP8_RX_SIZE
.................... #error You enabled EP8 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP8_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP8_TX_SIZE
.................... #undef USB_EP8_TX_SIZE
.................... #endif
.................... #define USB_EP8_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP8_TX_SIZE
.................... #error You enabled EP8 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 9 defines ----------
.................... #ifndef USB_EP9_TX_ENABLE
.................... #define USB_EP9_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP9_RX_ENABLE
.................... #define USB_EP9_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP9_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP9_RX_SIZE
.................... #undef USB_EP9_RX_SIZE
.................... #endif
.................... #define USB_EP9_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP9_RX_SIZE
.................... #error You enabled EP9 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP9_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP9_TX_SIZE
.................... #undef USB_EP9_TX_SIZE
.................... #endif
.................... #define USB_EP9_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP9_TX_SIZE
.................... #error You enabled EP9 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 10 defines ----------
.................... #ifndef USB_EP10_TX_ENABLE
.................... #define USB_EP10_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP10_RX_ENABLE
.................... #define USB_EP10_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP10_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP10_RX_SIZE
.................... #undef USB_EP10_RX_SIZE
.................... #endif
.................... #define USB_EP10_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP10_RX_SIZE
.................... #error You enabled EP10 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP10_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP10_TX_SIZE
.................... #undef USB_EP10_TX_SIZE
.................... #endif
.................... #define USB_EP10_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP10_TX_SIZE
.................... #error You enabled EP10 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 11 defines ----------
.................... #ifndef USB_EP11_TX_ENABLE
.................... #define USB_EP11_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP11_RX_ENABLE
.................... #define USB_EP11_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP11_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP11_RX_SIZE
.................... #undef USB_EP11_RX_SIZE
.................... #endif
.................... #define USB_EP11_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP11_RX_SIZE
.................... #error You enabled EP11 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP11_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP11_TX_SIZE
.................... #undef USB_EP11_TX_SIZE
.................... #endif
.................... #define USB_EP11_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP11_TX_SIZE
.................... #error You enabled EP11 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 12 defines ----------
.................... #ifndef USB_EP12_TX_ENABLE
.................... #define USB_EP12_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP12_RX_ENABLE
.................... #define USB_EP12_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP12_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP12_RX_SIZE
.................... #undef USB_EP12_RX_SIZE
.................... #endif
.................... #define USB_EP12_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP12_RX_SIZE
.................... #error You enabled EP12 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP12_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP12_TX_SIZE
.................... #undef USB_EP12_TX_SIZE
.................... #endif
.................... #define USB_EP12_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP12_TX_SIZE
.................... #error You enabled EP12 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 13 defines ----------
.................... #ifndef USB_EP13_TX_ENABLE
.................... #define USB_EP13_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP13_RX_ENABLE
.................... #define USB_EP13_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP13_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP13_RX_SIZE
.................... #undef USB_EP13_RX_SIZE
.................... #endif
.................... #define USB_EP13_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP13_RX_SIZE
.................... #error You enabled EP13 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP13_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP13_TX_SIZE
.................... #undef USB_EP13_TX_SIZE
.................... #endif
.................... #define USB_EP13_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP13_TX_SIZE
.................... #error You enabled EP13 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 14 defines ----------
.................... #ifndef USB_EP14_TX_ENABLE
.................... #define USB_EP14_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP14_RX_ENABLE
.................... #define USB_EP14_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP14_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP14_RX_SIZE
.................... #undef USB_EP14_RX_SIZE
.................... #endif
.................... #define USB_EP14_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP14_RX_SIZE
.................... #error You enabled EP14 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP14_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP14_TX_SIZE
.................... #undef USB_EP14_TX_SIZE
.................... #endif
.................... #define USB_EP14_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP14_TX_SIZE
.................... #error You enabled EP14 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 15 defines ----------
.................... #ifndef USB_EP15_TX_ENABLE
.................... #define USB_EP15_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP15_RX_ENABLE
.................... #define USB_EP15_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP15_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP15_RX_SIZE
.................... #undef USB_EP15_RX_SIZE
.................... #endif
.................... #define USB_EP15_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP15_RX_SIZE
.................... #error You enabled EP15 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP15_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP15_TX_SIZE
.................... #undef USB_EP15_TX_SIZE
.................... #endif
.................... #define USB_EP15_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP15_TX_SIZE
.................... #error You enabled EP15 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... const int8 usb_ep_tx_type[16]={
.................... USB_EP0_TX_ENABLE, USB_EP1_TX_ENABLE, USB_EP2_TX_ENABLE,
.................... USB_EP3_TX_ENABLE, USB_EP4_TX_ENABLE, USB_EP5_TX_ENABLE,
.................... USB_EP6_TX_ENABLE, USB_EP7_TX_ENABLE, USB_EP8_TX_ENABLE,
.................... USB_EP9_TX_ENABLE, USB_EP10_TX_ENABLE, USB_EP11_TX_ENABLE,
.................... USB_EP12_TX_ENABLE, USB_EP13_TX_ENABLE, USB_EP14_TX_ENABLE,
.................... USB_EP15_TX_ENABLE
.................... };
....................
.................... const int8 usb_ep_rx_type[16]={
.................... USB_EP0_RX_ENABLE, USB_EP1_RX_ENABLE, USB_EP2_RX_ENABLE,
.................... USB_EP3_RX_ENABLE, USB_EP4_RX_ENABLE, USB_EP5_RX_ENABLE,
.................... USB_EP6_RX_ENABLE, USB_EP7_RX_ENABLE, USB_EP8_RX_ENABLE,
.................... USB_EP9_RX_ENABLE, USB_EP10_RX_ENABLE, USB_EP11_RX_ENABLE,
.................... USB_EP12_RX_ENABLE, USB_EP13_RX_ENABLE, USB_EP14_RX_ENABLE,
.................... USB_EP15_RX_ENABLE
.................... };
....................
.................... const unsigned int16 usb_ep_tx_size[16]={
.................... USB_EP0_TX_SIZE, USB_EP1_TX_SIZE, USB_EP2_TX_SIZE,
.................... USB_EP3_TX_SIZE, USB_EP4_TX_SIZE, USB_EP5_TX_SIZE,
.................... USB_EP6_TX_SIZE, USB_EP7_TX_SIZE, USB_EP8_TX_SIZE,
.................... USB_EP9_TX_SIZE, USB_EP10_TX_SIZE, USB_EP11_TX_SIZE,
.................... USB_EP12_TX_SIZE, USB_EP13_TX_SIZE, USB_EP14_TX_SIZE,
.................... USB_EP15_TX_SIZE
.................... };
....................
.................... const unsigned int16 usb_ep_rx_size[16]={
.................... USB_EP0_RX_SIZE, USB_EP1_RX_SIZE, USB_EP2_RX_SIZE,
.................... USB_EP3_RX_SIZE, USB_EP4_RX_SIZE, USB_EP5_RX_SIZE,
.................... USB_EP6_RX_SIZE, USB_EP7_RX_SIZE, USB_EP8_RX_SIZE,
.................... USB_EP9_RX_SIZE, USB_EP10_RX_SIZE, USB_EP11_RX_SIZE,
.................... USB_EP12_RX_SIZE, USB_EP13_RX_SIZE, USB_EP14_RX_SIZE,
.................... USB_EP15_RX_SIZE
.................... };
....................
.................... #ENDIF
....................
....................
.................... #if defined(__PIC16_USB_H__)
.................... #include <pic_usb.c>
.................... #endif
....................
.................... #if defined(__PIC18_USB_H__)
.................... #include <pic18_usb.c>
.................... /////////////////////////////////////////////////////////////////////////
.................... //// pic18_usb.c ////
.................... //// ////
.................... //// Hardware layer for CCS's USB library. See pic18_usb.h more ////
.................... //// documentation about the PIC18 hardware layer. ////
.................... //// ////
.................... //// This file is part of CCS's PIC USB driver code. See USB.H ////
.................... //// for more documentation and a list of examples. ////
.................... //// ////
.................... /////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// Version History: ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// 18F14K50 family added. ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... //// Nov 3rd, 2008: ////
.................... //// * 4553 family added. ////
.................... //// ////
.................... //// Dec 18, 2007: ////
.................... //// * usb_kbhit() moved to device driver. ////
.................... //// * USB Token handler changed to workaround a flaw in the USB ////
.................... //// peripheral to prevent the USB peripheral from ////
.................... //// inadvertantly STALLing the endpoint. Happened most often ////
.................... //// in bulk demo applications, especially CDC. ////
.................... //// ////
.................... //// 11-6-07: Fixed a bug where usb_data_buffer[] was reserving ////
.................... //// too much RAM. ////
.................... //// USB_MAX_EP0_PACKET_LENGTH value can be overwritten. ////
.................... //// For the 18F4450/2450 family this should be 8 ////
.................... //// because of limited RAM. Reducing this value ////
.................... //// frees RAM for application. ////
.................... //// Based upon which endpoints have been configured for ////
.................... //// use, will free up unused USB data RAM for ////
.................... //// application dynamically. This should free up ////
.................... //// at least 128 bytes of RAM. ////
.................... //// CDC now fits on a 18F4450/2450 ////
.................... //// ////
.................... //// 09-19-07: Fixed problems with 18F4450 family. ////
.................... //// ////
.................... //// 07-17-07: Added 18F4450,2450 support ////
.................... //// ////
.................... //// 07-13-07: Added 87J50 family support ////
.................... //// ////
.................... //// 11-01-05: usb_detach(), usb_attach() and usb_init_cs() ////
.................... //// changed for the better. ////
.................... //// ////
.................... //// 10-28-05: Added usb_rx_packet_size() ////
.................... //// ////
.................... //// 07-13-05: usb_put_packet() changed for 16bit packet sizes ////
.................... //// usb_flush_in() changed for 16bit packet sizes ////
.................... //// usb_get_packet() changed for 16bit packet sizes ////
.................... //// usb_flush_out() changed for 16bit packet sizes ////
.................... //// usb_set_configured() changed for 16bit packet sizes ////
.................... //// ////
.................... //// 06-30-05: usb_tbe() added ////
.................... //// The way endpoint 0 DTS is set has been changed. ////
.................... //// ////
.................... //// 06-20-05: Initial Release ////
.................... //// ////
.................... //// 05-13-05: Beta Release (Full Speed works) ////
.................... //// ////
.................... //// 03-21-05: Initial Alpha Release ////
.................... //// ////
.................... /////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2009 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... /////////////////////////////////////////////////////////////////////////
....................
.................... #IFNDEF __PIC18_USB_C__
.................... #DEFINE __PIC18_USB_C__
....................
.................... #INCLUDE <usb.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// usb.h ////
.................... //// ////
.................... //// Function protypes, defintions and globals used by CCS USB driver ////
.................... //// ////
.................... //// This file is part of CCS's USB driver code ////
.................... //// ////
.................... //// The following USB examples are provided by CCS: ////
.................... //// ex_usb_mouse.c - A HID Mouse. ////
.................... //// ex_usb_hid.c - A custom application using HID protocol. ////
.................... //// ex_usb_kbmouse.c - A HID Mouse/Keyboard combo using multiple ////
.................... //// interfaces. ////
.................... //// ex_usb_kbmouse2.c - A HID Mouse/Keyboard combo using multiple ////
.................... //// HID Reports. ////
.................... //// ex_usb_scope.c - A digital oscilloscope using a custom ////
.................... //// protocol requiring custom Windows drivers. ////
.................... //// ex_usb_serial.c - ////
.................... //// ex_usb_serial2.c - Two examples of using the CDC driver for ////
.................... //// a virtual COM port. ////
.................... //// ex_usb_bootloader.c - CDC/Virtual COM port bootloader. ////
.................... //// ex_usb_loadmouse.c - A conversion of ex_usb_mouse.c that is ////
.................... //// compatible with ex_usb_mouse.c. ////
.................... //// ////
.................... //// ********************** API ********************* ////
.................... //// ////
.................... //// These are the functions that are meant to be called by the user: ////
.................... //// ////
.................... //// usb_init() - Initializes the USB stack, the USB peripheral and ////
.................... //// attaches the unit to the usb bus. Enables ////
.................... //// interrupts. Will wait in an infinite loop until ////
.................... //// the device enumerates - if you are using ////
.................... //// connection sense or if the processor should run ////
.................... //// even if it's not connected to USB then use ////
.................... //// usb_init_cs() instead. ////
.................... //// ////
.................... //// usb_init_cs() - A smaller usb_init(), does not attach unit ////
.................... //// to usb bus or enable interrupts. Since this does ////
.................... //// not attach to the USB, you must periodically call ////
.................... //// usb_task(). See usb_task() for more information. ////
.................... //// ////
.................... //// usb_task() - If usb_init_cs() was used to initiate the USB ////
.................... //// peripheral, usb_task() should then be called periodically ////
.................... //// to check the connection sense pin. If the connection ////
.................... //// sense pin denotes USB is connected and the USB peripheral ////
.................... //// is not attached, this will attach the USB peripheral ////
.................... //// so the PC can start the enumeration process (and it ////
.................... //// will enable interrupts). If the connection sense pin ////
.................... //// denotes USB is not attached and the USB peripheral is ////
.................... //// running, this will reset the USB peripheral and wait ////
.................... //// for USB to reconnect (and usb_enumerated() will start ////
.................... //// returning FALSE). If connection sense (USB_CON_SENSE_PIN) ////
.................... //// is not defined the usb_task() assumes that USB is always ////
.................... //// connected. ////
.................... //// ////
.................... //// usb_attached() - Returns TRUE if the device is attached to a ////
.................... //// USB cable. A macro that looks at the defined ////
.................... //// connection sense pin. If this returns TRUE ////
.................... //// it does not mean the PC has connected to it, ////
.................... //// you need to use usb_enumerated() to check this. ////
.................... //// ////
.................... //// usb_enumerated() - Returns TRUE if device has been enumerated ////
.................... //// (configured) by host, FALSE if it has not. ////
.................... //// Do not try to use the USB peripheral for ////
.................... //// sending and receiving packets until you ////
.................... //// are enumerated. ////
.................... //// ////
.................... //// usb_wait_for_enumeration() - Sits in an infinte loop until device ////
.................... //// is enumerated. ////
.................... //// ////
.................... //// usb_tbe(endpoint) - Returns TRUE if the endpoint transmit buffer ////
.................... //// is free and ready to accept a new packet for transmission. ////
.................... //// ////
.................... //// usb_put_packet(endpoint, ptr, len, tgl) - Sends one packet to the ////
.................... //// host. If you need to send a message that ////
.................... //// spans more than one packet then use ////
.................... //// usb_puts(). Fore more detailed documentation ////
.................... //// see usb_hw_layer.h ////
.................... //// ////
.................... //// usb_puts(endpoint, ptr, len, timeout) - Sends a multiple packet ////
.................... //// message to the host. If you only need to send one packet, ////
.................... //// it is more effecient to use usb_put_packet(). This is ////
.................... //// documented in more detail above the prototype in USB.H. ////
.................... //// ////
.................... //// usb_kbhit(endpoint) - Returns true if OUT endpoint contains data ////
.................... //// from host. This will remain TRUE until ////
.................... //// usb_put_packet() or usb_flush_out() used. ////
.................... //// This function will return an invalid response ////
.................... //// if specified endpoint is not enabled for ////
.................... //// receiving data. ////
.................... //// ////
.................... //// len = usb_get_packet(endpoint, ptr, max) - Gets one packet that ////
.................... //// from the host/PC. usb_kbhit() must return TRUE before you ////
.................... //// call this routine or your data may not be valid. This ////
.................... //// only receives one packet, if you are trying to receive a ////
.................... //// multi-packet message use usb_gets(). For more detailed ////
.................... //// documentation see usb_hw_layer.h. ////
.................... //// ////
.................... //// len = usb_gets(endpoint, ptr, max, timeout) - Gets multiple ////
.................... //// packets from the host, you would use this instead ////
.................... //// of usb_get_packet() if you wanted to handle multi-packet ////
.................... //// messages. This is documented in more detail above the ////
.................... //// prototype in USB.H. ////
.................... //// ////
.................... //// ////
.................... //// ********* DEFINITIONS / CONFIGURATION ********** ////
.................... //// ////
.................... //// The following definitions are declared here, but can be ////
.................... //// overwritten in your code. Unless needed otherwise, leave ////
.................... //// to default value. If confused about a definition read the ////
.................... //// comments at each defintion ////
.................... //// ////
.................... //// USB_HID_IDLE (TRUE) - Set to TRUE if your device supports ////
.................... //// Set_Idle HID class request. Set to ////
.................... //// False if you do not (device will ////
.................... //// send a Wrong-state if computer ////
.................... //// sends a Set_Idle / Get_Idle command) ////
.................... //// NOTE: If you set to TRUE you must ////
.................... //// provide your own code. See ////
.................... //// usb_isr_tkn_setup_ClassInterface() in ////
.................... //// usb.c ////
.................... //// ////
.................... //// USB_HID_BOOT_PROTOCOL (FALSE) - Set to TRUE if your device supports ////
.................... //// Set_Protocl HID class request. Set to ////
.................... //// False if you do not (device will ////
.................... //// send a Wrong-state if computer ////
.................... //// sends a Set_Protocl / Get_Protocol ////
.................... //// command). ////
.................... //// NOTE: If you set to TRUE you must ////
.................... //// provide your own code in the ////
.................... //// application that properly send boot ////
.................... //// or HID packets. ////
.................... //// ////
.................... //// USB_MAX_EP0_PACKET_LENGTH (8) - Max Packet size for Endpoint 0. ////
.................... //// The hardware level driver (ex ////
.................... //// pic18_usb.h will define this value if ////
.................... //// not already overwritten). Increasing ////
.................... //// this size will speed up the ////
.................... //// enumeration process. ////
.................... //// ////
.................... //// USB_EPx_RX_ENABLE (USB_ENABLE_DISABLED) - Where x is the ////
.................... //// endpoint number. Change this define ////
.................... //// to specify what kind of transfer method ////
.................... //// this RX (PC to device) endpoint uses. ////
.................... //// Here is the list of valid transfer methods: ////
.................... //// USB_ENABLE_CONTROL ////
.................... //// USB_ENABLE_ISOCHRONOUS ////
.................... //// USB_ENABLE_BULK ////
.................... //// USB_ENABLE_INTERRUPT ////
.................... //// USB_ENABLE_DISABLED ////
.................... //// Don't forget that you must specify the ////
.................... //// transfer method properly in your endpoint ////
.................... //// descriptor, too. ////
.................... //// ////
.................... //// USB_EPx_RX_SIZE (0) - For some hardware it is important to know ////
.................... //// how much memory to reserve for receiving ////
.................... //// packets. ////
.................... //// ////
.................... //// *** NOTE *** You must have both USB_EPx_RX_ENABLE defined and ////
.................... //// USB_EPx_RX_SIZE defined (non 0) to enable a RX ////
.................... //// endpoint. ////
.................... //// *** NOTE *** Endpoint 0 is always enabled. ////
.................... //// ////
.................... //// USB_EPx_TX_ENABLE (USB_ENABLE_DISABLED) - Where x is the ////
.................... //// endpoint number. Change this define ////
.................... //// to specify what kind of transfer method ////
.................... //// this TX (device to PC) endpoint uses. ////
.................... //// Here is the list of valid transfer methods: ////
.................... //// USB_ENABLE_CONTROL ////
.................... //// USB_ENABLE_ISOCHRONOUS ////
.................... //// USB_ENABLE_BULK ////
.................... //// USB_ENABLE_INTERRUPT ////
.................... //// USB_ENABLE_DISABLED ////
.................... //// Don't forget that you must specify the ////
.................... //// transfer method properly in your endpoint ////
.................... //// descriptor, too. ////
.................... //// ////
.................... //// USB_EPx_TX_SIZE (0) - For some hardware it is important to know ////
.................... //// how much memory to reserve for transmitting ////
.................... //// packets. ////
.................... //// ////
.................... //// *** NOTE *** You must have both USB_EPx_TX_ENABLE defined and ////
.................... //// USB_EPx_TX_SIZE defined (non 0) to enable a TX ////
.................... //// endpoint. ////
.................... //// ////
.................... //// ////
.................... //// USB_HID_DEVICE (TRUE) - HID devices require extra code to handle ////
.................... //// HID requests. You can disable to save ////
.................... //// ROM space if you are not using a HID ////
.................... //// device. If you are not using a HID ////
.................... //// device you must provide your own O/S ////
.................... //// (Windows) driver. ////
.................... //// ////
.................... //// The other definitions should not be changed. ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// Version History: ////
.................... //// ////
.................... //// March 5th, 2009: ////
.................... //// Cleanup for Wizard. ////
.................... //// PIC24 Initial release. ////
.................... //// ////
.................... //// July 13th, 2005: ////
.................... //// usb_ep_tx_size[] and usb_ep_rx_size[] changed to 16bits ////
.................... //// ////
.................... //// June 20th, 2005: ////
.................... //// Initial 18fxx5x release ////
.................... //// ////
.................... //// May 13th, 2005: ////
.................... //// Beta release, only works with 18Fxx5x hardware layer. ////
.................... //// Now supports multiple interfaces (many defines in descriptors ////
.................... //// will have to be changed, see examples) ////
.................... //// ////
.................... //// Mar 21st, 2005: ////
.................... //// Initial Alpha Release with PIC18Fxx5x support. (ONLY TESTED ////
.................... //// WITH 18F4550) ////
.................... //// usb_gets() and usb_puts() changed (see usb.c) ////
.................... //// ////
.................... //// June 24th, 2004: ////
.................... //// Optimization and cleanup. ////
.................... //// The following definitions changed: ////
.................... //// USB_EPx_TX_ENABLE and USB_EPx_RX_ENABLE have changed. See usb.h ////
.................... //// USB_CONFIG_DESCRIPTORS[] removed ////
.................... //// USB_CONFIG_DESC_LEN changed to USB_DESC_CONFIG_LEN ////
.................... //// USB_INTERFACE_DESC_LEN changed to USB_DESC_INTERFACE_LEN ////
.................... //// USB_CLASS_DESC_LEN changed to USB_DESC_CLASS_LEN ////
.................... //// USB_ENDPOINT_DESC_LEN changed to USB_DESC_ENDPOINT_LEN ////
.................... //// USB_CONFIG_DESC_KEY changed to USB_DESC_CONFIG_TYPE ////
.................... //// USB_INTERFACE_DESC_KEY changed to USB_DESC_INTERFACE_TYPE ////
.................... //// USB_CLASS_DESC_KEY changed to USB_DESC_CLASS_TYPE ////
.................... //// USB_ENDPOINT_DESC_KEY changed to USB_DESC_ENDPOINT_TYPE ////
.................... //// USB_STRING_X[] arrays removed, see USB_STRING_DESC[] and ////
.................... //// USB_STRING_DESC_OFFSET[] ////
.................... //// dev_req, curr_config, status_device and getdesc_type global ////
.................... //// variables moved into struct USB_stack_status ////
.................... //// ////
.................... //// October 15th, 2003: Support for boot protocol added. ////
.................... //// Set USB_HID_BOOT_PROTOCOL to TRUE to support this. ////
.................... //// The array hid_protocol[] saves which protocol mode each ////
.................... //// interface is in. It is your applications job to send ////
.................... //// data that either fit the boot protocol or HID protocol. ////
.................... //// ////
.................... //// May 6th, 2003: Fixed a potential stack overflow using PCM ////
.................... //// ////
.................... //// October 29th, 2002: New definition added to USB_STATES ////
.................... //// ////
.................... //// August 2nd, 2002: Initial Public Release ////
.................... //// ////
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2009 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS ////
.................... //// C compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, ////
.................... //// reproduction or distribution is permitted without written ////
.................... //// permission. Derivative programs created using this software ////
.................... //// in object code form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #IFNDEF __USB_PROTOTYPES__
.................... #DEFINE __USB_PROTOTYPES__
....................
.................... //// CONFIGURATION ////////////////////////////////////////////////////////////
....................
.................... #ifndef USB_CON_SENSE_PIN
.................... #define USB_CON_SENSE_PIN 0
.................... #endif
....................
.................... #IFNDEF USB_HID_BOOT_PROTOCOL
.................... #DEFINE USB_HID_BOOT_PROTOCOL FALSE
.................... #ENDIF
....................
.................... #IFNDEF USB_HID_IDLE
.................... #DEFINE USB_HID_IDLE FALSE
.................... #ENDIF
....................
.................... //should the compiler add the extra HID handler code? Defaults to yes.
.................... #IFNDEF USB_HID_DEVICE
.................... #DEFINE USB_HID_DEVICE TRUE
.................... #ENDIF
....................
.................... #IFNDEF USB_CDC_DEVICE
.................... #DEFINE USB_CDC_DEVICE FALSE
.................... #ENDIF
....................
.................... //set to false to opt for less RAM, true to opt for less ROM
.................... #ifndef USB_OPT_FOR_ROM
.................... #define USB_OPT_FOR_ROM TRUE
.................... #endif
....................
.................... #IFNDEF USB_MAX_EP0_PACKET_LENGTH
.................... #DEFINE USB_MAX_EP0_PACKET_LENGTH 8
.................... #ENDIF
....................
....................
.................... ////// USER-LEVEL API /////////////////////////////////////////////////////////
....................
.................... /**************************************************************
.................... /* usb_enumerated()
.................... /*
.................... /* Input: Global variable USB_Curr_Config
.................... /* Returns: Returns a 1 if device is configured / enumerated,
.................... /* Returns a 0 if device is un-configured / not enumerated.
.................... /*
.................... /* Summary: See API section of USB.H for more documentation.
.................... /***************************************************************/
.................... int1 usb_enumerated(void);
....................
.................... /**************************************************************
.................... /* usb_wait_for_enumeration()
.................... /*
.................... /* Input: Global variable USB_Curr_Config
.................... /*
.................... /* Summary: Waits in-definately until device is configured / enumerated.
.................... /* See API section of USB.H for more information.
.................... /***************************************************************/
.................... void usb_wait_for_enumeration(void);
....................
.................... /****************************************************************************
.................... /* usb_gets(endpoint, ptr, max, timeout)
.................... /*
.................... /* Input: endpoint - endpoint to get data from
.................... /* ptr - place / array to store data to
.................... /* max - max amount of data to get from USB and store into ptr
.................... /* timeout - time in milliseconds, for each packet, to wait before
.................... /* timeout. set to 0 for no timeout.
.................... /*
.................... /* Output: Amount of data returned. It may be less than max.
.................... /*
.................... /* Summary: Gets data from the host. Will get multiple-packet messages
.................... /* and finish when either it receives a 0-len packet or a packet
.................... /* of less size than maximum.
.................... /*
.................... /*****************************************************************************/
.................... unsigned int16 usb_gets(int8 endpoint, int8 * ptr, unsigned int16 max, unsigned int16 timeout);
....................
.................... /****************************************************************************
.................... /* usb_puts()
.................... /*
.................... /* Inputs: endpoint - endpoint to send data out
.................... /* ptr - points to array of data to send
.................... /* len - amount of data to send
.................... /* timeout - time in milli-seconds, for each packet, to wait before
.................... /* timeout. set to 0 for no timeout.
.................... /*
.................... /* Outputs: Returns TRUE if message sent succesfully, FALSE if it was not
.................... /* sent before timeout period expired.
.................... /*
.................... /* Summary: Used for sending multiple packets of data as one message. This
.................... /* function can still be used to send messages consiting of only one
.................... /* packet. See usb_put_packet() documentation for the rules about when
.................... /* multiple packet messages or 0-lenght packets are needed.
.................... /*
.................... /*****************************************************************************/
.................... int1 usb_puts(int8 endpoint, int8 * ptr, unsigned int16 len, unsigned int8 timeout);
....................
.................... /******************************************************************************
.................... /* usb_attached()
.................... /*
.................... /* Summary: Returns TRUE if the device is attached to a USB cable.
.................... /* See the API section of USB.H for more documentation.
.................... /*
.................... /*****************************************************************************/
.................... #if USB_CON_SENSE_PIN
.................... #define usb_attached() input(USB_CON_SENSE_PIN)
.................... #else
.................... #define usb_attached() TRUE
.................... #endif
....................
.................... ////// END USER-LEVEL API /////////////////////////////////////////////////////
....................
....................
.................... ////// STACK-LEVEL API USED BY HW DRIVERS ////////////////////////////////////
....................
.................... enum USB_STATES {GET_DESCRIPTOR=1,SET_ADDRESS=2,NONE=0};
....................
.................... enum USB_GETDESC_TYPES {USB_GETDESC_CONFIG_TYPE=0,USB_GETDESC_HIDREPORT_TYPE=1,USB_GETDESC_STRING_TYPE=2,USB_GETDESC_DEVICE_TYPE=3};
....................
.................... #if USB_OPT_FOR_ROM
.................... typedef struct {
.................... USB_STATES dev_req; //what did the last setup token set us up to do?. init at none
.................... int curr_config; //our current config. start at none/powered (NOT THAT THIS LIMITS US TO 3 CONFIGURATIONS)
.................... int status_device; //Holds our state for Set_Feature and Clear_Feature
.................... USB_GETDESC_TYPES getdesc_type; //which get_descriptor() we are handling
.................... } TYPE_USB_STACK_STATUS;
.................... #else
.................... typedef struct {
.................... USB_STATES dev_req:2; //what did the last setup token set us up to do?. init at none
.................... int Curr_config:2; //our current config. start at none/powered (NOT THAT THIS LIMITS US TO 3 CONFIGURATIONS)
.................... int status_device:2; //Holds our state for Set_Feature and Clear_Feature
.................... USB_GETDESC_TYPES getdesc_type:2; //which get_descriptor() we are handling
.................... } TYPE_USB_STACK_STATUS;
.................... #endif
....................
.................... extern TYPE_USB_STACK_STATUS USB_stack_status;
....................
.................... /**************************************************************
.................... /* usb_token_reset()
.................... /*
.................... /* Output: No output (but many global registers are modified)
.................... /*
.................... /* Summary: Resets the token handler to initial (unconfigured) state.
.................... /***************************************************************/
.................... void usb_token_reset(void);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_setup_dne()
.................... /*
.................... /* Input: usb_ep0_rx_buffer[] contains the the setup packet.
.................... /*
.................... /* Output: None (many globals are changed)
.................... /*
.................... /* Summary: This function is that handles the setup token.
.................... /* We must handle all relevant requests, such as Set_Configuration,
.................... /* Get_Descriptor, etc.
.................... /*
.................... /* usb_ep0_rx_buffer[] contains setup data packet, which has the
.................... /* following records:
.................... /* -------------------------------------------------------------------------------------------
.................... /* usb_ep0_rx_buffer[ 0 ]=bmRequestType; Where the setup packet goes
.................... /* bit7 (0) host-to-device
.................... /* (1) device-to-host
.................... /* bit6-5 (00) usb standard request;
.................... /* (01) class request;
.................... /* (10) vendor request
.................... /* (11) reserved
.................... /* bit4-0 (0000) device
.................... /* (0001) interface
.................... /* (0010) endpoint
.................... /* (0011) other element
.................... /* (0100) to (1111) reserved
.................... /* usb_ep0_rx_buffer[ 1 ]=bRequest ; the request
.................... /* usb_ep0_rx_buffer[2,3]=wValue ; a value which corresponds to request
.................... /* usb_ep0_rx_buffer[4,5]=wIndex ; could correspond to interface or endpoint...
.................... /* usb_ep0_rx_buffer[6,7]=wLength ; number of bytes in next data packet;
.................... /* for host-to-device, this exactly how many bytes in data packet.
.................... /* for device-to-host, this is the maximum bytes that can fit one packet.
.................... /***************************************************************/
.................... void usb_isr_tok_setup_dne(void);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_out_dne()
.................... /*
.................... /* Input: endpoint contains which endpoint we are receiving data (0..15)
.................... /*
.................... /* Summary: Processes out tokens (out is respective of the host, so actualy
.................... /* incoming to the pic), but not out setup tokens. Normally when
.................... /* data is received it is left in the buffer (user would use
.................... /* usb_kbhit() and usb_get_packet() to receive data), but certain
.................... /* libraries (like CDC) have to answer setup packets.
.................... /*
.................... /***************************************************************/
.................... void usb_isr_tok_out_dne(int8 endpoint);
....................
.................... /**************************************************************
.................... /* usb_isr_tok_in_dne(endpoint)
.................... /*
.................... /* Input: endpoint - which endpoint we are processing a setup token.
.................... /*
.................... /* Summary: This handles an IN packet (HOST <- PIC). For endpoint 0, this
.................... /* is usually to setup a response packet to a setup packet. Endpoints 1..15
.................... /* are generally ignored, and the user has to use usb_tbe() to determine if
.................... /* if the buffer is ready for a new transmit packet (there are special cases,
.................... /* like CDC which handles the CDC protocl).
.................... /*
.................... /***************************************************************/
.................... void usb_isr_tok_in_dne(int8 endpoint);
....................
.................... ////// END STACK-LEVEL API USED BY HW DRIVERS /////////////////////////////////
....................
....................
.................... //CCS only supports one configuration at this time
.................... #DEFINE USB_NUM_CONFIGURATIONS 1 //DO NOT CHANGE
....................
.................... //PID values for tokens (see page 48 of USB Complete ed.1)
.................... #define PID_IN 0x09 //device to host transactions
.................... #define PID_OUT 0x01 //host to device transactions
.................... #define PID_SETUP 0x0D //host to device setup transaction
.................... #define PID_ACK 0x02 //receiver accepts error-free data packet
.................... #define PID_DATA0 0x03 //data packet with even sync bit
.................... #define PID_SOF 0x05 //start of framer marker and frame number
.................... #define PID_NAK 0x0A //receiver can't accept data or sender cant send data or has no data to transmit
.................... #define PID_DATA1 0x0B //data packet with odd sync bit
.................... #define PID_PRE 0x0C //preamble issued by host. enables downstream traffic to low-speed device
.................... #define PID_STALL 0x0E //a control request isnt supported or the endpoint is halted
....................
.................... //Key which identifies descritpors
.................... #DEFINE USB_DESC_DEVICE_TYPE 0x01 //#DEFINE USB_DEVICE_DESC_KEY 0x01
.................... #DEFINE USB_DESC_CONFIG_TYPE 0x02 //#DEFINE USB_CONFIG_DESC_KEY 0x02
.................... #DEFINE USB_DESC_STRING_TYPE 0x03 //#DEFINE USB_STRING_DESC_KEY 0x03
.................... #DEFINE USB_DESC_INTERFACE_TYPE 0x04 //#DEFINE USB_INTERFACE_DESC_KEY 0x04
.................... #DEFINE USB_DESC_ENDPOINT_TYPE 0x05 //#DEFINE USB_ENDPOINT_DESC_KEY 0x05
.................... #DEFINE USB_DESC_CLASS_TYPE 0x21 //#DEFINE USB_CLASS_DESC_KEY 0x21
.................... #DEFINE USB_DESC_HIDREPORT_TYPE 0x22
....................
.................... //The length of each descriptor
.................... #DEFINE USB_DESC_DEVICE_LEN 18 //#DEFINE USB_DEVICE_DESC_LEN 18
.................... #DEFINE USB_DESC_CONFIG_LEN 9 //#DEFINE USB_CONFIG_DESC_LEN 9
.................... #DEFINE USB_DESC_INTERFACE_LEN 9 //#DEFINE USB_INTERFACE_DESC_LEN 9
.................... #DEFINE USB_DESC_CLASS_LEN 9 //#DEFINE USB_CLASS_DESC_LEN 9
.................... #DEFINE USB_DESC_ENDPOINT_LEN 7 //#DEFINE USB_ENDPOINT_DESC_LEN 7
....................
.................... //Standard USB Setup bRequest Codes
.................... #define USB_STANDARD_REQUEST_GET_STATUS 0x00
.................... #define USB_STANDARD_REQUEST_CLEAR_FEATURE 0x01
.................... #define USB_STANDARD_REQUEST_SET_FEATURE 0x03
.................... #define USB_STANDARD_REQUEST_SET_ADDRESS 0x05
.................... #define USB_STANDARD_REQUEST_GET_DESCRIPTOR 0x06
.................... #define USB_STANDARD_REQUEST_SET_DESCRIPTOR 0x07
.................... #define USB_STANDARD_REQUEST_GET_CONFIGURATION 0x08
.................... #define USB_STANDARD_REQUEST_SET_CONFIGURATION 0x09
.................... #define USB_STANDARD_REQUEST_GET_INTERFACE 0x0A
.................... #define USB_STANDARD_REQUEST_SET_INTERFACE 0x0B
.................... #define USB_STANDARD_REQUEST_SYNCH_FRAME 0x0C
....................
.................... //HID Class Setup bRequest Codes
.................... #define USB_HID_REQUEST_GET_REPORT 0x01
.................... #define USB_HID_REQUEST_GET_IDLE 0x02
.................... #define USB_HID_REQUEST_GET_PROTOCOL 0x03
.................... #define USB_HID_REQUEST_SET_REPORT 0x09
.................... #define USB_HID_REQUEST_SET_IDLE 0x0A
.................... #define USB_HID_REQUEST_SET_PROTOCOL 0x0B
....................
.................... //types of endpoints as defined in the descriptor
.................... #define USB_ENDPOINT_TYPE_CONTROL 0x00
.................... #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
.................... #define USB_ENDPOINT_TYPE_BULK 0x02
.................... #define USB_ENDPOINT_TYPE_INTERRUPT 0x03
....................
.................... //types of endpoints used internally in this api
.................... #define USB_ENABLE_DISABLED -1
.................... #define USB_ENABLE_BULK USB_ENDPOINT_TYPE_BULK
.................... #define USB_ENABLE_ISOCHRONOUS USB_ENDPOINT_TYPE_ISOCHRONOUS
.................... #define USB_ENABLE_INTERRUPT USB_ENDPOINT_TYPE_INTERRUPT
.................... #define USB_ENABLE_CONTROL USB_ENDPOINT_TYPE_CONTROL
....................
....................
.................... //*** ENABLE RX ENDPOINTS AND BUFFERS
....................
.................... //--------- endpoint 0 defines ----------
.................... #define USB_EP0_TX_ENABLE USB_ENABLE_CONTROL
.................... #define USB_EP0_RX_ENABLE USB_ENABLE_CONTROL
.................... #define USB_EP0_RX_SIZE USB_MAX_EP0_PACKET_LENGTH //endpoint 0 is setup, and should always be the MAX_PACKET_LENGTH. Slow speed specifies 8
.................... #define USB_EP0_TX_SIZE USB_MAX_EP0_PACKET_LENGTH //endpoint 0 is setup, and should always be the MAX_PACKET_LENGTH. Slow speed specifies 8
....................
.................... //--------- endpoint 1 defines ----------
.................... #ifndef USB_EP1_TX_ENABLE
.................... #define USB_EP1_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP1_RX_ENABLE
.................... #define USB_EP1_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP1_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP1_RX_SIZE
.................... #undef USB_EP1_RX_SIZE
.................... #endif
.................... #define USB_EP1_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP1_RX_SIZE
.................... #error You enabled EP1 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP1_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP1_TX_SIZE
.................... #undef USB_EP1_TX_SIZE
.................... #endif
.................... #define USB_EP1_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP1_TX_SIZE
.................... #error You enabled EP1 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 2 defines ----------
.................... #ifndef USB_EP2_TX_ENABLE
.................... #define USB_EP2_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP2_RX_ENABLE
.................... #define USB_EP2_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP2_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP2_RX_SIZE
.................... #undef USB_EP2_RX_SIZE
.................... #endif
.................... #define USB_EP2_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP2_RX_SIZE
.................... #error You enabled EP2 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP2_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP2_TX_SIZE
.................... #undef USB_EP2_TX_SIZE
.................... #endif
.................... #define USB_EP2_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP2_TX_SIZE
.................... #error You enabled EP2 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 3 defines ----------
.................... #ifndef USB_EP3_TX_ENABLE
.................... #define USB_EP3_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP3_RX_ENABLE
.................... #define USB_EP3_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP3_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP3_RX_SIZE
.................... #undef USB_EP3_RX_SIZE
.................... #endif
.................... #define USB_EP3_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP3_RX_SIZE
.................... #error You enabled EP3 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP3_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP3_TX_SIZE
.................... #undef USB_EP3_TX_SIZE
.................... #endif
.................... #define USB_EP3_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP3_TX_SIZE
.................... #error You enabled EP3 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 4 defines ----------
.................... #ifndef USB_EP4_TX_ENABLE
.................... #define USB_EP4_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP4_RX_ENABLE
.................... #define USB_EP4_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP4_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP4_RX_SIZE
.................... #undef USB_EP4_RX_SIZE
.................... #endif
.................... #define USB_EP4_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP4_RX_SIZE
.................... #error You enabled EP4 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP4_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP4_TX_SIZE
.................... #undef USB_EP4_TX_SIZE
.................... #endif
.................... #define USB_EP4_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP4_TX_SIZE
.................... #error You enabled EP4 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 5 defines ----------
.................... #ifndef USB_EP5_TX_ENABLE
.................... #define USB_EP5_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP5_RX_ENABLE
.................... #define USB_EP5_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP5_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP5_RX_SIZE
.................... #undef USB_EP5_RX_SIZE
.................... #endif
.................... #define USB_EP5_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP5_RX_SIZE
.................... #error You enabled EP5 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP5_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP5_TX_SIZE
.................... #undef USB_EP5_TX_SIZE
.................... #endif
.................... #define USB_EP5_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP5_TX_SIZE
.................... #error You enabled EP5 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 6 defines ----------
.................... #ifndef USB_EP6_TX_ENABLE
.................... #define USB_EP6_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP6_RX_ENABLE
.................... #define USB_EP6_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP6_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP6_RX_SIZE
.................... #undef USB_EP6_RX_SIZE
.................... #endif
.................... #define USB_EP6_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP6_RX_SIZE
.................... #error You enabled EP6 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP6_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP6_TX_SIZE
.................... #undef USB_EP6_TX_SIZE
.................... #endif
.................... #define USB_EP6_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP6_TX_SIZE
.................... #error You enabled EP6 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 7 defines ----------
.................... #ifndef USB_EP7_TX_ENABLE
.................... #define USB_EP7_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP7_RX_ENABLE
.................... #define USB_EP7_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP7_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP7_RX_SIZE
.................... #undef USB_EP7_RX_SIZE
.................... #endif
.................... #define USB_EP7_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP7_RX_SIZE
.................... #error You enabled EP7 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP7_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP7_TX_SIZE
.................... #undef USB_EP7_TX_SIZE
.................... #endif
.................... #define USB_EP7_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP7_TX_SIZE
.................... #error You enabled EP7 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 8 defines ----------
.................... #ifndef USB_EP8_TX_ENABLE
.................... #define USB_EP8_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP8_RX_ENABLE
.................... #define USB_EP8_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP8_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP8_RX_SIZE
.................... #undef USB_EP8_RX_SIZE
.................... #endif
.................... #define USB_EP8_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP8_RX_SIZE
.................... #error You enabled EP8 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP8_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP8_TX_SIZE
.................... #undef USB_EP8_TX_SIZE
.................... #endif
.................... #define USB_EP8_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP8_TX_SIZE
.................... #error You enabled EP8 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 9 defines ----------
.................... #ifndef USB_EP9_TX_ENABLE
.................... #define USB_EP9_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP9_RX_ENABLE
.................... #define USB_EP9_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP9_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP9_RX_SIZE
.................... #undef USB_EP9_RX_SIZE
.................... #endif
.................... #define USB_EP9_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP9_RX_SIZE
.................... #error You enabled EP9 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP9_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP9_TX_SIZE
.................... #undef USB_EP9_TX_SIZE
.................... #endif
.................... #define USB_EP9_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP9_TX_SIZE
.................... #error You enabled EP9 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 10 defines ----------
.................... #ifndef USB_EP10_TX_ENABLE
.................... #define USB_EP10_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP10_RX_ENABLE
.................... #define USB_EP10_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP10_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP10_RX_SIZE
.................... #undef USB_EP10_RX_SIZE
.................... #endif
.................... #define USB_EP10_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP10_RX_SIZE
.................... #error You enabled EP10 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP10_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP10_TX_SIZE
.................... #undef USB_EP10_TX_SIZE
.................... #endif
.................... #define USB_EP10_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP10_TX_SIZE
.................... #error You enabled EP10 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 11 defines ----------
.................... #ifndef USB_EP11_TX_ENABLE
.................... #define USB_EP11_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP11_RX_ENABLE
.................... #define USB_EP11_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP11_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP11_RX_SIZE
.................... #undef USB_EP11_RX_SIZE
.................... #endif
.................... #define USB_EP11_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP11_RX_SIZE
.................... #error You enabled EP11 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP11_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP11_TX_SIZE
.................... #undef USB_EP11_TX_SIZE
.................... #endif
.................... #define USB_EP11_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP11_TX_SIZE
.................... #error You enabled EP11 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 12 defines ----------
.................... #ifndef USB_EP12_TX_ENABLE
.................... #define USB_EP12_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP12_RX_ENABLE
.................... #define USB_EP12_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP12_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP12_RX_SIZE
.................... #undef USB_EP12_RX_SIZE
.................... #endif
.................... #define USB_EP12_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP12_RX_SIZE
.................... #error You enabled EP12 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP12_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP12_TX_SIZE
.................... #undef USB_EP12_TX_SIZE
.................... #endif
.................... #define USB_EP12_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP12_TX_SIZE
.................... #error You enabled EP12 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 13 defines ----------
.................... #ifndef USB_EP13_TX_ENABLE
.................... #define USB_EP13_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP13_RX_ENABLE
.................... #define USB_EP13_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP13_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP13_RX_SIZE
.................... #undef USB_EP13_RX_SIZE
.................... #endif
.................... #define USB_EP13_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP13_RX_SIZE
.................... #error You enabled EP13 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP13_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP13_TX_SIZE
.................... #undef USB_EP13_TX_SIZE
.................... #endif
.................... #define USB_EP13_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP13_TX_SIZE
.................... #error You enabled EP13 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 14 defines ----------
.................... #ifndef USB_EP14_TX_ENABLE
.................... #define USB_EP14_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP14_RX_ENABLE
.................... #define USB_EP14_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP14_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP14_RX_SIZE
.................... #undef USB_EP14_RX_SIZE
.................... #endif
.................... #define USB_EP14_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP14_RX_SIZE
.................... #error You enabled EP14 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP14_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP14_TX_SIZE
.................... #undef USB_EP14_TX_SIZE
.................... #endif
.................... #define USB_EP14_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP14_TX_SIZE
.................... #error You enabled EP14 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
....................
.................... //--------- endpoint 15 defines ----------
.................... #ifndef USB_EP15_TX_ENABLE
.................... #define USB_EP15_TX_ENABLE USB_ENABLE_DISABLED
.................... #endif
.................... #ifndef USB_EP15_RX_ENABLE
.................... #define USB_EP15_RX_ENABLE USB_ENABLE_DISABLED
.................... #endif
....................
.................... #if USB_EP15_RX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP15_RX_SIZE
.................... #undef USB_EP15_RX_SIZE
.................... #endif
.................... #define USB_EP15_RX_SIZE 0
.................... #else
.................... #ifndef USB_EP15_RX_SIZE
.................... #error You enabled EP15 for RX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... #if USB_EP15_TX_ENABLE==USB_ENABLE_DISABLED
.................... #ifdef USB_EP15_TX_SIZE
.................... #undef USB_EP15_TX_SIZE
.................... #endif
.................... #define USB_EP15_TX_SIZE 0
.................... #else
.................... #ifndef USB_EP15_TX_SIZE
.................... #error You enabled EP15 for TX but didn't specify endpoint size
.................... #endif
.................... #endif
....................
.................... const int8 usb_ep_tx_type[16]={
.................... USB_EP0_TX_ENABLE, USB_EP1_TX_ENABLE, USB_EP2_TX_ENABLE,
.................... USB_EP3_TX_ENABLE, USB_EP4_TX_ENABLE, USB_EP5_TX_ENABLE,
.................... USB_EP6_TX_ENABLE, USB_EP7_TX_ENABLE, USB_EP8_TX_ENABLE,
.................... USB_EP9_TX_ENABLE, USB_EP10_TX_ENABLE, USB_EP11_TX_ENABLE,
.................... USB_EP12_TX_ENABLE, USB_EP13_TX_ENABLE, USB_EP14_TX_ENABLE,
.................... USB_EP15_TX_ENABLE
.................... };
....................
.................... const int8 usb_ep_rx_type[16]={
.................... USB_EP0_RX_ENABLE, USB_EP1_RX_ENABLE, USB_EP2_RX_ENABLE,
.................... USB_EP3_RX_ENABLE, USB_EP4_RX_ENABLE, USB_EP5_RX_ENABLE,
.................... USB_EP6_RX_ENABLE, USB_EP7_RX_ENABLE, USB_EP8_RX_ENABLE,
.................... USB_EP9_RX_ENABLE, USB_EP10_RX_ENABLE, USB_EP11_RX_ENABLE,
.................... USB_EP12_RX_ENABLE, USB_EP13_RX_ENABLE, USB_EP14_RX_ENABLE,
.................... USB_EP15_RX_ENABLE
.................... };
....................
.................... const unsigned int16 usb_ep_tx_size[16]={
.................... USB_EP0_TX_SIZE, USB_EP1_TX_SIZE, USB_EP2_TX_SIZE,
.................... USB_EP3_TX_SIZE, USB_EP4_TX_SIZE, USB_EP5_TX_SIZE,
.................... USB_EP6_TX_SIZE, USB_EP7_TX_SIZE, USB_EP8_TX_SIZE,
.................... USB_EP9_TX_SIZE, USB_EP10_TX_SIZE, USB_EP11_TX_SIZE,
.................... USB_EP12_TX_SIZE, USB_EP13_TX_SIZE, USB_EP14_TX_SIZE,
.................... USB_EP15_TX_SIZE
.................... };
....................
.................... const unsigned int16 usb_ep_rx_size[16]={
.................... USB_EP0_RX_SIZE, USB_EP1_RX_SIZE, USB_EP2_RX_SIZE,
.................... USB_EP3_RX_SIZE, USB_EP4_RX_SIZE, USB_EP5_RX_SIZE,
.................... USB_EP6_RX_SIZE, USB_EP7_RX_SIZE, USB_EP8_RX_SIZE,
.................... USB_EP9_RX_SIZE, USB_EP10_RX_SIZE, USB_EP11_RX_SIZE,
.................... USB_EP12_RX_SIZE, USB_EP13_RX_SIZE, USB_EP14_RX_SIZE,
.................... USB_EP15_RX_SIZE
.................... };
....................
.................... #ENDIF
....................
....................
.................... //if you are worried that the PIC is not receiving packets because a bug in the
.................... //DATA0/DATA1 synch code, you can set this to TRUE to ignore the DTS on
.................... //receiving.
.................... #ifndef USB_IGNORE_RX_DTS
.................... #define USB_IGNORE_RX_DTS FALSE
.................... #endif
....................
.................... #ifndef USB_IGNORE_TX_DTS
.................... #define USB_IGNORE_TX_DTS FALSE
.................... #endif
....................
.................... #if ((getenv("DEVICE")=="PIC18F87J50") || (getenv("DEVICE")=="PIC18F86J55") || \
.................... (getenv("DEVICE")=="PIC18F86J50") || (getenv("DEVICE")=="PIC18F85J50") || \
.................... (getenv("DEVICE")=="PIC18F67J50") || (getenv("DEVICE")=="PIC18F66J55") || \
.................... (getenv("DEVICE")=="PIC18F66J50") || (getenv("DEVICE")=="PIC18F65J50"))
.................... #define __USB_87J50__
.................... #define USB_TOTAL_RAM_SPACE ((int16)getenv("RAM")-0x400)
.................... #define USB_RAM_START 0x400
.................... #define USB_LAST_ALLOWED_ENDPOINT 16
.................... #elif ((getenv("DEVICE")=="PIC18F2450") || (getenv("DEVICE")=="PIC18F4450"))
.................... #define __USB_4450__
.................... #define USB_TOTAL_RAM_SPACE ((int16)0x100)
.................... #define USB_RAM_START 0x400
.................... #define USB_LAST_ALLOWED_ENDPOINT 3
.................... #elif ((getenv("DEVICE")=="PIC18F13K50") || (getenv("DEVICE")=="PIC18F14K50"))
.................... #define __USB_K50__
.................... #define USB_TOTAL_RAM_SPACE ((int16)0x200)
.................... #define USB_RAM_START 0x200
.................... #define USB_LAST_ALLOWED_ENDPOINT 8
.................... #elif ((getenv("DEVICE")=="PIC18F2455") || (getenv("DEVICE")=="PIC18F2550") || \
.................... (getenv("DEVICE")=="PIC18F4455") || (getenv("DEVICE")=="PIC18F4550") || \
.................... (getenv("DEVICE")=="PIC18F2458") || (getenv("DEVICE")=="PIC18F2553") || \
.................... (getenv("DEVICE")=="PIC18F4458") || (getenv("DEVICE")=="PIC18F4553") \
.................... )
.................... #define __USB_4550__
.................... #define USB_TOTAL_RAM_SPACE ((int16)0x400)
.................... #define USB_RAM_START 0x400
.................... #define USB_LAST_ALLOWED_ENDPOINT 16
.................... #else
.................... #error Unknown PIC device, USB not supported in this library.
.................... #endif
....................
.................... #if USB_EP15_TX_SIZE || USB_EP15_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 15
.................... #elif USB_EP14_TX_SIZE || USB_EP14_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 14
.................... #elif USB_EP13_TX_SIZE || USB_EP13_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 13
.................... #elif USB_EP12_TX_SIZE || USB_EP12_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 12
.................... #elif USB_EP11_TX_SIZE || USB_EP11_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 11
.................... #elif USB_EP10_TX_SIZE || USB_EP10_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 10
.................... #elif USB_EP9_TX_SIZE || USB_EP9_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 9
.................... #elif USB_EP8_TX_SIZE || USB_EP8_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 8
.................... #elif USB_EP7_TX_SIZE || USB_EP7_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 7
.................... #elif USB_EP6_TX_SIZE || USB_EP6_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 6
.................... #elif USB_EP5_TX_SIZE || USB_EP5_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 5
.................... #elif USB_EP4_TX_SIZE || USB_EP4_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 4
.................... #elif USB_EP3_TX_SIZE || USB_EP3_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 3
.................... #elif USB_EP2_TX_SIZE || USB_EP2_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 2
.................... #elif USB_EP1_TX_SIZE || USB_EP1_RX_SIZE
.................... #define USB_LAST_DEFINED_ENDPOINT 1
.................... #else
.................... #define USB_LAST_DEFINED_ENDPOINT 0
.................... #endif
....................
.................... #define USB_CONTROL_REGISTER_SIZE ((USB_LAST_DEFINED_ENDPOINT+1)*8)
....................
.................... #define USB_DATA_BUFFER_NEEDED (USB_EP0_TX_SIZE+USB_EP0_RX_SIZE+USB_EP1_TX_SIZE+\
.................... USB_EP1_RX_SIZE+USB_EP2_TX_SIZE+USB_EP2_RX_SIZE+\
.................... USB_EP3_TX_SIZE+USB_EP3_RX_SIZE+USB_EP4_TX_SIZE+\
.................... USB_EP4_RX_SIZE+USB_EP5_TX_SIZE+USB_EP5_RX_SIZE+\
.................... USB_EP6_TX_SIZE+USB_EP6_RX_SIZE+USB_EP7_TX_SIZE+\
.................... USB_EP7_RX_SIZE+USB_EP8_TX_SIZE+USB_EP8_RX_SIZE+\
.................... USB_EP9_TX_SIZE+USB_EP9_RX_SIZE+USB_EP10_TX_SIZE+\
.................... USB_EP10_RX_SIZE+USB_EP11_TX_SIZE+USB_EP11_RX_SIZE+\
.................... USB_EP12_TX_SIZE+USB_EP12_RX_SIZE+USB_EP13_TX_SIZE+\
.................... USB_EP13_RX_SIZE+USB_EP14_TX_SIZE+USB_EP14_RX_SIZE+\
.................... USB_EP15_TX_SIZE+USB_EP15_RX_SIZE)
....................
.................... #if ((USB_DATA_BUFFER_NEEDED+USB_CONTROL_REGISTER_SIZE) > USB_TOTAL_RAM_SPACE)
.................... #error You are trying to allocate more memory for endpoints than the PIC can handle
.................... #endif
....................
.................... #if (USB_LAST_DEFINED_ENDPOINT > USB_LAST_ALLOWED_ENDPOINT)
.................... #error You are trying ot use an invalid endpoint for this hardware!
.................... #endif
....................
.................... #define USB_DATA_BUFFER_LOCATION ((int16)USB_RAM_START+USB_CONTROL_REGISTER_SIZE)
....................
.................... typedef struct
.................... {
.................... int8 stat;
.................... int8 cnt;
.................... int16 addr;
.................... } STRUCT_BD;
....................
.................... struct
.................... {
.................... struct
.................... {
.................... STRUCT_BD out; //pc -> pic
.................... STRUCT_BD in; //pc <- pic
.................... } bd[USB_LAST_DEFINED_ENDPOINT+1];
.................... union
.................... {
.................... struct
.................... {
.................... int8 ep0_rx_buffer[USB_MAX_EP0_PACKET_LENGTH];
.................... int8 ep0_tx_buffer[USB_MAX_EP0_PACKET_LENGTH];
....................
.................... //these buffer definitions needed for CDC library
.................... #if USB_EP1_RX_SIZE
.................... int8 ep1_rx_buffer[USB_EP1_RX_SIZE];
.................... #endif
.................... #if USB_EP1_TX_SIZE
.................... int8 ep1_tx_buffer[USB_EP1_TX_SIZE];
.................... #endif
.................... #if USB_EP2_RX_SIZE
.................... int8 ep2_rx_buffer[USB_EP2_RX_SIZE];
.................... #endif
.................... #if USB_EP2_TX_SIZE
.................... int8 ep2_tx_buffer[USB_EP2_TX_SIZE];
.................... #endif
.................... };
.................... int8 general[USB_DATA_BUFFER_NEEDED];
.................... } buffer;
.................... } g_USBRAM;
.................... #locate g_USBRAM=USB_RAM_START
....................
.................... #define usb_ep0_rx_buffer g_USBRAM.buffer.ep0_rx_buffer
.................... #define usb_ep0_tx_buffer g_USBRAM.buffer.ep0_tx_buffer
....................
.................... //these buffer definitions needed for CDC library
.................... #define usb_ep1_rx_buffer g_USBRAM.buffer.ep1_rx_buffer
.................... #define usb_ep1_tx_buffer g_USBRAM.buffer.ep1_tx_buffer
.................... #define usb_ep2_rx_buffer g_USBRAM.buffer.ep2_rx_buffer
.................... #define usb_ep2_tx_buffer g_USBRAM.buffer.ep2_tx_buffer
....................
.................... #define debug_usb(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z)
.................... //#define debug_usb printf
.................... //#define debug_putc putc_tbe
.................... #define debug_display_ram(x,y)
.................... /*
.................... void debug_display_ram(int8 len, int8 *ptr) {
.................... int8 max=16;
.................... debug_usb(debug_putc,"%U - ",len);
.................... if (max>len) {max=len;}
.................... while(max--) {
.................... debug_usb(debug_putc,"%X",*ptr);
.................... len--;
.................... ptr++;
.................... }
.................... if (len) {debug_usb(debug_putc,"...");}
.................... }
.................... */
....................
.................... //if you enable this it will keep a counter of the 6 possible errors the
.................... //pic can detect. disabling this will save you ROM, RAM and execution time.
.................... #if !defined(USB_USE_ERROR_COUNTER)
.................... #define USB_USE_ERROR_COUNTER FALSE
.................... #endif
....................
.................... #define USB_PING_PONG_MODE_OFF 0 //no ping pong
.................... #define USB_PING_PONG_MODE_E0 1 //ping pong endpoint 0 only
.................... #define USB_PING_PONG_MODE_ON 2 //ping pong all endpoints
....................
.................... //NOTE - PING PONG MODE IS NOT SUPPORTED BY CCS!
.................... #if !defined(USB_PING_PONG_MODE)
.................... #define USB_PING_PONG_MODE USB_PING_PONG_MODE_OFF
.................... #endif
....................
.................... #if USB_USE_ERROR_COUNTER
.................... int ERROR_COUNTER[6];
.................... #endif
....................
.................... //---pic18fxx5x memory locations
.................... #if defined(__USB_4550__) || defined(__USB_4450__)
.................... #byte UFRML = 0xF66
.................... #byte UFRMH = 0xF67
.................... #byte UIR = 0xF68
.................... #byte UIE = 0xF69
.................... #byte UEIR = 0xF6A
.................... #byte UEIE = 0xF6B
.................... #byte USTAT = 0xF6C
.................... #byte UCON = 0xF6D
.................... #byte UADDR = 0xF6E
.................... #byte UCFG = 0xF6F
.................... #define UEP0_LOC 0xF70
.................... #elif defined(__USB_K50__)
.................... #byte UFRML = 0xF5D
.................... #byte UFRMH = 0xF5E
.................... #byte UIR = 0xF62
.................... #byte UIE = 0xF60
.................... #byte UEIR = 0xF5F
.................... #byte UEIE = 0xF5B
.................... #byte USTAT = 0xF63
.................... #byte UCON = 0xF64
.................... #byte UADDR = 0xF5C
.................... #byte UCFG = 0xF61
.................... #define UEP0_LOC 0xF53
.................... #else
.................... #byte UFRML = 0xF60
.................... #byte UFRMH = 0xF61
.................... #byte UIR = 0xF62
.................... #byte UIE = 0xF5C
.................... #byte UEIR = 0xF63
.................... #byte UEIE = 0xF5D
.................... #byte USTAT = 0xF64
.................... #byte UCON = 0xF65
.................... #byte UADDR = 0xF5E
.................... #byte UCFG = 0xF5F
.................... #define UEP0_LOC 0xF4C
.................... #endif
....................
.................... int8 g_UEP[16];
.................... #locate g_UEP=UEP0_LOC
.................... #define UEP(x) g_UEP[x]
....................
.................... #BIT UIR_SOF = UIR.6
.................... #BIT UIR_STALL = UIR.5
.................... #BIT UIR_IDLE = UIR.4
.................... #BIT UIR_TRN = UIR.3
.................... #BIT UIR_ACTV = UIR.2
.................... #BIT UIR_UERR = UIR.1
.................... #BIT UIR_URST = UIR.0
....................
.................... #BIT UIE_SOF = UIE.6
.................... #BIT UIE_STALL = UIE.5
.................... #BIT UIE_IDLE = UIE.4
.................... #BIT UIE_TRN = UIE.3
.................... #BIT UIE_ACTV = UIE.2
.................... #BIT UIE_UERR = UIE.1
.................... #BIT UIE_URST = UIE.0
....................
.................... #bit UCON_PBRST=UCON.6
.................... #bit UCON_SE0=UCON.5
.................... #bit UCON_PKTDIS=UCON.4
.................... #bit UCON_USBEN=UCON.3
.................... #bit UCON_RESUME=UCON.2
.................... #bit UCON_SUSPND=UCON.1
....................
.................... #if (USB_PING_PONG_MODE==USB_PING_PONG_MODE_OFF)
.................... #define EP_BDxST_O(x) g_USBRAM.bd[x].out.stat
.................... #define EP_BDxCNT_O(x) g_USBRAM.bd[x].out.cnt
.................... #define EP_BDxADR_O(x) g_USBRAM.bd[x].out.addr
.................... #define EP_BDxST_I(x) g_USBRAM.bd[x].in.stat
.................... #define EP_BDxCNT_I(x) g_USBRAM.bd[x].in.cnt
.................... #define EP_BDxADR_I(x) g_USBRAM.bd[x].in.addr
.................... #else
.................... #error Right now this driver only supports no ping pong
.................... #endif
....................
.................... //See UEPn (0xF70-0xF7F)
.................... #define ENDPT_DISABLED 0x00 //endpoint not used
.................... #define ENDPT_IN_ONLY 0x02 //endpoint supports IN transactions only
.................... #define ENDPT_OUT_ONLY 0x04 //endpoint supports OUT transactions only
.................... #define ENDPT_CONTROL 0x06 //Supports IN, OUT and CONTROL transactions - Only use with EP0
.................... #define ENDPT_NON_CONTROL 0x0E //Supports both IN and OUT transactions
....................
.................... //Define the states that the USB interface can be in
.................... enum {USB_STATE_DETACHED=0, USB_STATE_ATTACHED=1, USB_STATE_POWERED=2, USB_STATE_DEFAULT=3,
.................... USB_STATE_ADDRESS=4, USB_STATE_CONFIGURED=5} usb_state=0;
....................
.................... //--BDendST has their PIDs upshifed 2
.................... #define USB_PIC_PID_IN 0x24 //device to host transactions
.................... #define USB_PIC_PID_OUT 0x04 //host to device transactions
.................... #define USB_PIC_PID_SETUP 0x34 //host to device setup transaction
....................
.................... #define USTAT_IN_E0 4
.................... #define USTAT_OUT_SETUP_E0 0
....................
.................... #define __USB_UIF_RESET 0x01
.................... #define __USB_UIF_ERROR 0x02
.................... #define __USB_UIF_ACTIVE 0x04
.................... #define __USB_UIF_TOKEN 0x08
.................... #define __USB_UIF_IDLE 0x10
.................... #define __USB_UIF_STALL 0x20
.................... #define __USB_UIF_SOF 0x40
....................
.................... #if USB_USE_ERROR_COUNTER
.................... #define STANDARD_INTS __USB_UIF_STALL|__USB_UIF_IDLE|__USB_UIF_TOKEN|__USB_UIF_ACTIVE|__USB_UIF_ERROR|__USB_UIF_RESET
.................... #else
.................... #define STANDARD_INTS __USB_UIF_STALL|__USB_UIF_IDLE|__USB_UIF_TOKEN|__USB_UIF_ACTIVE|__USB_UIF_RESET
.................... #endif
....................
.................... #define __USB_UCFG_UTEYE 0x80
.................... #if defined(__USB_4550__)
.................... #define __USB_UCFG_UOEMON 0x40
.................... #endif
.................... #define __USB_UCFG_UPUEN 0x10
.................... #define __USB_UCFG_UTRDIS 0x08
.................... #define __USB_UCFG_FSEN 0x04
....................
.................... #if USB_USE_FULL_SPEED
.................... #define __UCFG_VAL_ENABLED__ (__USB_UCFG_UPUEN | __USB_UCFG_FSEN | USB_PING_PONG_MODE)
.................... #else
.................... #define __UCFG_VAL_ENABLED__ (__USB_UCFG_UPUEN | USB_PING_PONG_MODE);
.................... #endif
....................
.................... #define __UCFG_VAL_DISABLED__ 0x08
....................
.................... int8 __setup_0_tx_size;
....................
.................... //interrupt handler, specific to PIC18Fxx5x peripheral only
.................... void usb_handle_interrupt();
.................... void usb_isr_rst();
.................... void usb_isr_uerr();
.................... void usb_isr_sof(void);
.................... void usb_isr_activity();
.................... void usb_isr_uidle();
.................... void usb_isr_tok_dne();
.................... void usb_isr_stall(void);
.................... void usb_init_ep0_setup(void);
....................
.................... //// BEGIN User Functions:
....................
.................... // see usb_hw_layer.h for more documentation
.................... int1 usb_kbhit(int8 en)
.................... {
.................... return((UEP(en)!=ENDPT_DISABLED)&&(!bit_test(EP_BDxST_O(en),7)));
.................... }
....................
.................... // see usb_hw_layer.h for documentation
.................... int1 usb_tbe(int8 en)
.................... {
.................... return((UEP(en)!=ENDPT_DISABLED)&&(!bit_test(EP_BDxST_I(en),7)));
*
0D06: CLRF 03
0D08: MOVLB 7
0D0A: MOVF x47,W
0D0C: ADDLW 70
0D0E: MOVWF FE9
0D10: MOVLW 0F
0D12: ADDWFC 03,W
0D14: MOVWF FEA
0D16: MOVF FEF,F
0D18: BZ 0D50
0D1A: CLRF x49
0D1C: MOVFF 747,748
0D20: CLRF x4B
0D22: MOVLW 08
0D24: MOVWF x4A
0D26: MOVLB 0
0D28: CALL 02BA
0D2C: MOVFF 02,749
0D30: MOVFF 01,748
0D34: MOVLW 04
0D36: MOVLB 7
0D38: ADDWF x48,F
0D3A: MOVLW 00
0D3C: ADDWFC x49,F
0D3E: MOVFF 748,FE9
0D42: MOVLW 04
0D44: ADDWF x49,W
0D46: MOVWF FEA
0D48: MOVFF FEF,748
0D4C: BTFSS x48.7
0D4E: BRA 0D54
0D50: MOVLW 00
0D52: BRA 0D56
0D54: MOVLW 01
0D56: MOVWF 01
.................... }
0D58: MOVLB 0
0D5A: RETLW 00
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_detach(void)
.................... {
.................... UCON = 0; //disable USB hardware
*
12F4: CLRF F6D
.................... UIE = 0; //disable USB interrupts
12F6: CLRF F69
.................... UCFG = __UCFG_VAL_DISABLED__;
12F8: MOVLW 08
12FA: MOVWF F6F
....................
.................... // set D+/D- to inputs
.................... #if defined(__USB_87J50__)
.................... set_tris_f(get_tris_f() | 0x18);
.................... #elif defined(__USB_K50__)
.................... set_tris_a(get_tris_a() | 0x3);
.................... #else
.................... set_tris_c(get_tris_c() | 0x30);
12FC: MOVF F94,W
12FE: IORLW 30
1300: MOVLB 6
1302: MOVWF F94
.................... #endif
....................
.................... usb_state = USB_STATE_DETACHED;
1304: CLRF 24
1306: CLRF 18
1308: BTFSC FF2.7
130A: BSF 18.7
130C: BCF FF2.7
....................
.................... usb_token_reset(); //clear the chapter9 stack
130E: MOVLB 0
1310: CALL 037E
1314: BTFSC 18.7
1316: BSF FF2.7
.................... //__usb_kbhit_status=0;
.................... }
1318: GOTO 131E (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_attach(void)
.................... {
*
1322: CLRF 18
1324: BTFSC FF2.7
1326: BSF 18.7
1328: BCF FF2.7
.................... usb_token_reset();
132A: CALL 037E
132E: BTFSC 18.7
1330: BSF FF2.7
.................... UCON = 0;
1332: CLRF F6D
.................... UCFG = __UCFG_VAL_ENABLED__;
1334: MOVLW 14
1336: MOVWF F6F
.................... UIE = 0; // Mask all USB interrupts
1338: CLRF F69
.................... UCON_USBEN = 1; // Enable module & attach to bus
133A: BSF F6D.3
.................... usb_state = USB_STATE_ATTACHED; // Defined in usbmmap.c & .h
133C: MOVLW 01
133E: MOVWF 24
.................... }
1340: GOTO 134A (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_init_cs(void)
.................... {
.................... usb_detach();
*
131C: BRA 12F4
.................... }
131E: GOTO 136A (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_task(void)
.................... {
.................... if (usb_attached())
.................... {
.................... if (UCON_USBEN==0)
*
1344: BTFSC F6D.3
1346: BRA 134A
.................... {
.................... debug_usb(debug_putc, "\r\n\nUSB TASK: ATTACH");
.................... usb_attach();
1348: BRA 1322
.................... }
.................... }
.................... else
.................... {
.................... if (UCON_USBEN==1)
.................... {
.................... debug_usb(debug_putc, "\r\n\nUSB TASK: DE-ATTACH");
.................... usb_detach();
.................... }
.................... }
....................
.................... if ((usb_state == USB_STATE_ATTACHED)&&(!UCON_SE0))
134A: DECFSZ 24,W
134C: BRA 1364
134E: BTFSC F6D.5
1350: BRA 1364
.................... {
.................... UIR=0;
1352: CLRF F68
.................... UIE=0;
1354: CLRF F69
.................... enable_interrupts(INT_USB);
1356: BSF FA0.5
.................... enable_interrupts(GLOBAL);
1358: MOVLW C0
135A: IORWF FF2,F
.................... UIE=__USB_UIF_IDLE | __USB_UIF_RESET; //enable IDLE and RESET USB ISR
135C: MOVLW 11
135E: MOVWF F69
.................... usb_state=USB_STATE_POWERED;
1360: MOVLW 02
1362: MOVWF 24
.................... debug_usb(debug_putc, "\r\n\nUSB TASK: POWERED");
.................... }
.................... }
1364: GOTO 136C (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_init(void)
.................... {
.................... usb_init_cs();
1368: BRA 131C
....................
.................... do
.................... {
.................... usb_task();
136A: BRA 1344
.................... } while (usb_state != USB_STATE_POWERED);
136C: MOVF 24,W
136E: SUBLW 02
1370: BNZ 136A
.................... }
1372: GOTO 1FE4 (RETURN)
....................
....................
.................... // see pic18_usb.h for documentation
.................... int1 usb_flush_in(int8 endpoint, int16 len, USB_DTS_BIT tgl)
.................... {
.................... int8 i;
....................
.................... debug_usb(debug_putc,"\r\nPUT %X %U %LU",endpoint, tgl, len);
....................
.................... if (usb_tbe(endpoint))
*
0D5C: MOVFF 742,747
0D60: RCALL 0D06
0D62: MOVF 01,F
0D64: BTFSC FD8.2
0D66: BRA 0E74
.................... {
.................... EP_BDxCNT_I(endpoint)=len;
0D68: MOVLB 7
0D6A: CLRF x49
0D6C: MOVFF 742,748
0D70: CLRF x4B
0D72: MOVLW 08
0D74: MOVWF x4A
0D76: MOVLB 0
0D78: CALL 02BA
0D7C: MOVFF 02,748
0D80: MOVFF 01,747
0D84: MOVLW 04
0D86: MOVLB 7
0D88: ADDWF x47,F
0D8A: MOVLW 00
0D8C: ADDWFC x48,F
0D8E: MOVLW 01
0D90: ADDWF x47,W
0D92: MOVWF 01
0D94: MOVLW 00
0D96: ADDWFC x48,W
0D98: MOVWF 03
0D9A: MOVFF 01,FE9
0D9E: MOVLW 04
0DA0: ADDWF 03,W
0DA2: MOVWF FEA
0DA4: MOVFF 743,FEF
....................
.................... debug_display_ram(len, EP_BDxADR_I(endpoint));
....................
.................... #if USB_IGNORE_TX_DTS
.................... i=0x80;
.................... #else
.................... if (tgl == USB_DTS_TOGGLE)
0DA8: MOVF x45,W
0DAA: SUBLW 02
0DAC: BNZ 0DEE
.................... {
.................... i = EP_BDxST_I(endpoint);
0DAE: CLRF x49
0DB0: MOVFF 742,748
0DB4: CLRF x4B
0DB6: MOVLW 08
0DB8: MOVWF x4A
0DBA: MOVLB 0
0DBC: CALL 02BA
0DC0: MOVFF 02,748
0DC4: MOVFF 01,747
0DC8: MOVLW 04
0DCA: MOVLB 7
0DCC: ADDWF x47,F
0DCE: MOVLW 00
0DD0: ADDWFC x48,F
0DD2: MOVFF 747,FE9
0DD6: MOVLW 04
0DD8: ADDWF x48,W
0DDA: MOVWF FEA
0DDC: MOVFF FEF,746
.................... if (bit_test(i,6))
0DE0: BTFSS x46.6
0DE2: BRA 0DE8
.................... tgl = USB_DTS_DATA0; //was DATA1, goto DATA0
0DE4: CLRF x45
.................... else
0DE6: BRA 0DEC
.................... tgl = USB_DTS_DATA1; //was DATA0, goto DATA1
0DE8: MOVLW 01
0DEA: MOVWF x45
.................... }
.................... else if (tgl == USB_DTS_USERX)
0DEC: BRA 0E22
0DEE: MOVF x45,W
0DF0: SUBLW 04
0DF2: BNZ 0E22
.................... {
.................... i = EP_BDxST_O(endpoint);
0DF4: CLRF x49
0DF6: MOVFF 742,748
0DFA: CLRF x4B
0DFC: MOVLW 08
0DFE: MOVWF x4A
0E00: MOVLB 0
0E02: CALL 02BA
0E06: MOVLB 7
0E08: MOVFF 01,FE9
0E0C: MOVLW 04
0E0E: ADDWF 02,W
0E10: MOVWF FEA
0E12: MOVFF FEF,746
.................... if (bit_test(i,6))
0E16: BTFSS x46.6
0E18: BRA 0E20
.................... tgl = USB_DTS_DATA1;
0E1A: MOVLW 01
0E1C: MOVWF x45
.................... else
0E1E: BRA 0E22
.................... tgl = USB_DTS_DATA0;
0E20: CLRF x45
.................... }
.................... if (tgl == USB_DTS_DATA1)
0E22: DECFSZ x45,W
0E24: BRA 0E2C
.................... i=0xC8; //DATA1, UOWN
0E26: MOVLW C8
0E28: MOVWF x46
.................... else //if (tgl == USB_DTS_DATA0)
0E2A: BRA 0E30
.................... i=0x88; //DATA0, UOWN
0E2C: MOVLW 88
0E2E: MOVWF x46
.................... #endif
....................
.................... //set BC8 and BC9
.................... if (bit_test(len,8)) {bit_set(i,0);}
0E30: BTFSC x44.0
0E32: BSF x46.0
.................... if (bit_test(len,9)) {bit_set(i,1);}
0E34: BTFSC x44.1
0E36: BSF x46.1
....................
.................... debug_usb(debug_putc, " %X", i);
....................
.................... EP_BDxST_I(endpoint) = i;//save changes
0E38: CLRF x49
0E3A: MOVFF 742,748
0E3E: CLRF x4B
0E40: MOVLW 08
0E42: MOVWF x4A
0E44: MOVLB 0
0E46: CALL 02BA
0E4A: MOVFF 02,748
0E4E: MOVFF 01,747
0E52: MOVLW 04
0E54: MOVLB 7
0E56: ADDWF x47,F
0E58: MOVLW 00
0E5A: ADDWFC x48,F
0E5C: MOVFF 747,FE9
0E60: MOVLW 04
0E62: ADDWF x48,W
0E64: MOVWF FEA
0E66: MOVFF 746,FEF
....................
.................... //putc('!');
....................
.................... return(1);
0E6A: MOVLW 01
0E6C: MOVWF 01
0E6E: BRA 0E7A
.................... }
.................... else
0E70: BRA 0E72
0E72: MOVLB 0
.................... {
.................... //putc('_');
.................... debug_usb(debug_putc,"\r\nPUT ERR");
.................... }
.................... return(0);
0E74: MOVLW 00
0E76: MOVWF 01
0E78: MOVLB 7
.................... }
0E7A: MOVLB 0
0E7C: RETLW 00
....................
.................... // see usb_hw_layer.h for documentation
.................... int1 usb_put_packet(int8 endpoint, int8 * ptr, int16 len, USB_DTS_BIT tgl)
.................... {
.................... int8 * buff_add;
....................
.................... if (usb_tbe(endpoint))
*
0F88: MOVFF 73A,747
0F8C: RCALL 0D06
0F8E: MOVF 01,F
0F90: BZ 1026
.................... {
.................... buff_add = EP_BDxADR_I(endpoint);
0F92: MOVLB 7
0F94: CLRF x49
0F96: MOVFF 73A,748
0F9A: CLRF x4B
0F9C: MOVLW 08
0F9E: MOVWF x4A
0FA0: MOVLB 0
0FA2: CALL 02BA
0FA6: MOVFF 02,743
0FAA: MOVFF 01,742
0FAE: MOVLW 04
0FB0: MOVLB 7
0FB2: ADDWF x42,F
0FB4: MOVLW 00
0FB6: ADDWFC x43,F
0FB8: MOVLW 02
0FBA: ADDWF x42,W
0FBC: MOVWF 01
0FBE: MOVLW 00
0FC0: ADDWFC x43,W
0FC2: MOVWF 03
0FC4: MOVFF 01,FE9
0FC8: MOVLW 04
0FCA: ADDWF 03,W
0FCC: MOVWF FEA
0FCE: MOVFF FEC,03
0FD2: MOVF FED,F
0FD4: MOVFF FEF,740
0FD8: MOVFF 03,741
.................... memcpy(buff_add, ptr, len);
0FDC: MOVFF 741,FEA
0FE0: MOVFF 740,FE9
0FE4: MOVFF 73C,FE2
0FE8: MOVFF 73B,FE1
0FEC: MOVFF 73E,02
0FF0: MOVFF 73D,01
0FF4: MOVF 01,F
0FF6: BZ 0FFC
0FF8: INCF 02,F
0FFA: BRA 1000
0FFC: MOVF 02,F
0FFE: BZ 100C
1000: MOVFF FE6,FEE
1004: DECFSZ 01,F
1006: BRA 1000
1008: DECFSZ 02,F
100A: BRA 1000
....................
.................... return(usb_flush_in(endpoint, len, tgl));
100C: MOVFF 73A,742
1010: MOVFF 73E,744
1014: MOVFF 73D,743
1018: MOVFF 73F,745
101C: MOVLB 0
101E: RCALL 0D5C
1020: MOVF 01,W
1022: BRA 102A
.................... }
.................... else
1024: BRA 1026
.................... {
.................... //putc('-');
.................... //printf("%X", EP_BDxST_I(endpoint));
.................... debug_usb(debug_putc,"\r\nPUT ERR");
.................... }
....................
.................... return(0);
1026: MOVLW 00
1028: MOVWF 01
.................... }
102A: RETLW 00
....................
.................... // see pic18_usb.h for documentation
.................... void usb_flush_out(int8 endpoint, USB_DTS_BIT tgl)
.................... {
.................... int8 i;
.................... int16 len;
....................
.................... #if USB_IGNORE_RX_DTS
.................... if (tgl == USB_DTS_STALL)
.................... {
.................... debug_usb(debug_putc, '*');
.................... EP_BDxCNT_O(endpoint) = 0x84;
.................... EP_BDxST_I(endpoint) = 0x84;
.................... return;
.................... }
.................... else
.................... i=0x80;
.................... #else
.................... i = EP_BDxST_O(endpoint);
*
0BEA: MOVLB 7
0BEC: CLRF x49
0BEE: MOVFF 6FD,748
0BF2: CLRF x4B
0BF4: MOVLW 08
0BF6: MOVWF x4A
0BF8: MOVLB 0
0BFA: CALL 02BA
0BFE: MOVLB 7
0C00: MOVFF 01,FE9
0C04: MOVLW 04
0C06: ADDWF 02,W
0C08: MOVWF FEA
0C0A: MOVFF FEF,6FF
0C0E: MOVLB 6
.................... if (tgl == USB_DTS_TOGGLE)
0C10: MOVF xFE,W
0C12: SUBLW 02
0C14: BNZ 0C22
.................... {
.................... if (bit_test(i,6))
0C16: BTFSS xFF.6
0C18: BRA 0C1E
.................... tgl = USB_DTS_DATA0; //was DATA1, goto DATA0
0C1A: CLRF xFE
.................... else
0C1C: BRA 0C22
.................... tgl = USB_DTS_DATA1; //was DATA0, goto DATA1
0C1E: MOVLW 01
0C20: MOVWF xFE
.................... }
.................... if (tgl == USB_DTS_STALL)
0C22: MOVF xFE,W
0C24: SUBLW 03
0C26: BNZ 0C64
.................... {
.................... i = 0x84;
0C28: MOVLW 84
0C2A: MOVWF xFF
.................... EP_BDxST_I(endpoint) = 0x84; //stall both in and out endpoints
0C2C: MOVLB 7
0C2E: CLRF x49
0C30: MOVFF 6FD,748
0C34: CLRF x4B
0C36: MOVLW 08
0C38: MOVWF x4A
0C3A: MOVLB 0
0C3C: CALL 02BA
0C40: MOVFF 02,703
0C44: MOVFF 01,702
0C48: MOVLW 04
0C4A: MOVLB 7
0C4C: ADDWF x02,F
0C4E: MOVLW 00
0C50: ADDWFC x03,F
0C52: MOVFF 702,FE9
0C56: MOVLW 04
0C58: ADDWF x03,W
0C5A: MOVWF FEA
0C5C: MOVLW 84
0C5E: MOVWF FEF
.................... }
.................... else if (tgl == USB_DTS_DATA1)
0C60: BRA 0C74
0C62: MOVLB 6
0C64: DECFSZ xFE,W
0C66: BRA 0C6E
.................... i = 0xC8; //DATA1, UOWN
0C68: MOVLW C8
0C6A: MOVWF xFF
.................... else //if (tgl == USB_DTS_DATA0)
0C6C: BRA 0C72
.................... i = 0x88; //DATA0, UOWN
0C6E: MOVLW 88
0C70: MOVWF xFF
0C72: MOVLB 7
.................... #endif
....................
.................... //bit_clear(__usb_kbhit_status,endpoint);
....................
.................... len = usb_ep_rx_size[endpoint];
0C74: BCF FD8.0
0C76: MOVLB 6
0C78: RLCF xFD,W
0C7A: CLRF 03
0C7C: MOVFF FF2,702
0C80: BCF FF2.7
0C82: MOVLB 0
0C84: CALL 011A
0C88: TBLRD*+
0C8A: MOVFF FF5,03
0C8E: MOVLB 7
0C90: BTFSC x02.7
0C92: BSF FF2.7
0C94: MOVWF x00
0C96: MOVFF 03,701
.................... EP_BDxCNT_O(endpoint) = len;
0C9A: CLRF x49
0C9C: MOVFF 6FD,748
0CA0: CLRF x4B
0CA2: MOVLW 08
0CA4: MOVWF x4A
0CA6: MOVLB 0
0CA8: CALL 02BA
0CAC: MOVFF 01,702
0CB0: MOVLW 01
0CB2: MOVLB 7
0CB4: ADDWF 01,W
0CB6: MOVWF 01
0CB8: MOVLW 00
0CBA: ADDWFC 02,W
0CBC: MOVWF 03
0CBE: MOVFF 01,FE9
0CC2: MOVLW 04
0CC4: ADDWF 03,W
0CC6: MOVWF FEA
0CC8: MOVFF 700,FEF
.................... if (bit_test(len,8)) {bit_set(i,0);}
0CCC: BTFSS x01.0
0CCE: BRA 0CD6
0CD0: MOVLB 6
0CD2: BSF xFF.0
0CD4: MOVLB 7
.................... if (bit_test(len,9)) {bit_set(i,1);}
0CD6: BTFSS x01.1
0CD8: BRA 0CE0
0CDA: MOVLB 6
0CDC: BSF xFF.1
0CDE: MOVLB 7
....................
.................... EP_BDxST_O(endpoint) = i;
0CE0: CLRF x49
0CE2: MOVFF 6FD,748
0CE6: CLRF x4B
0CE8: MOVLW 08
0CEA: MOVWF x4A
0CEC: MOVLB 0
0CEE: CALL 02BA
0CF2: MOVLB 7
0CF4: MOVFF 01,FE9
0CF8: MOVLW 04
0CFA: ADDWF 02,W
0CFC: MOVWF FEA
0CFE: MOVFF 6FF,FEF
.................... }
0D02: MOVLB 0
0D04: RETLW 00
....................
.................... // see pic18_usb.h for documentation
.................... int16 usb_rx_packet_size(int8 endpoint)
.................... {
.................... return(EP_BDxCNT_O(endpoint));
*
0EE6: MOVLB 7
0EE8: CLRF x49
0EEA: MOVFF 6FE,748
0EEE: CLRF x4B
0EF0: MOVLW 08
0EF2: MOVWF x4A
0EF4: MOVLB 0
0EF6: CALL 02BA
0EFA: MOVFF 02,700
0EFE: MOVFF 01,6FF
0F02: MOVLW 01
0F04: MOVLB 6
0F06: ADDWF 01,W
0F08: MOVWF 01
0F0A: MOVLW 00
0F0C: MOVLB 7
0F0E: ADDWFC 02,W
0F10: MOVWF 03
0F12: MOVFF 01,FE9
0F16: MOVLW 04
0F18: ADDWF 03,W
0F1A: MOVWF FEA
0F1C: CLRF 03
0F1E: MOVFF FEF,01
0F22: MOVFF 03,02
.................... }
0F26: MOVLB 0
0F28: GOTO 0F3A (RETURN)
....................
.................... /// END User Functions
....................
....................
.................... /// BEGIN Hardware layer functions required by USB.
....................
.................... /*****************************************************************************
.................... /* usb_get_packet_buffer(endpoint, *ptr, max)
.................... /*
.................... /* Input: endpoint - endpoint to get data from
.................... /* ptr - where to save data to local PIC RAM
.................... /* max - max amount of data to receive from buffer
.................... /*
.................... /* Output: the amount of data taken from the buffer.
.................... /*
.................... /* Summary: Gets a packet of data from the USB buffer and puts into local PIC
.................... /* RAM.
.................... /* Does not mark the endpoint as ready for more data. Once you are
.................... /* done with data, call usb_flush_out() to mark the endpoint ready
.................... /* to receive more data.
.................... /*
.................... /*****************************************************************************/
.................... static int16 usb_get_packet_buffer(int8 endpoint, int8 *ptr, int16 max)
.................... {
.................... int8 * al;
.................... int8 st;
.................... int16 i;
....................
.................... al = EP_BDxADR_O(endpoint);
.................... i = EP_BDxCNT_O(endpoint);
.................... st = EP_BDxST_O(endpoint);
....................
.................... //read BC8 and BC9
.................... if (bit_test(st,0)) {bit_set(i,8);}
.................... if (bit_test(st,1)) {bit_set(i,9);}
....................
.................... if (i < max) {max = i;}
....................
.................... memcpy(ptr, al ,max);
....................
.................... return(max);
.................... }
....................
.................... // see usb_hw_layer.h for documentation
.................... unsigned int16 usb_get_packet(int8 endpoint, int8 * ptr, unsigned int16 max)
.................... {
.................... max = usb_get_packet_buffer(endpoint, ptr, max);
.................... usb_flush_out(endpoint, USB_DTS_TOGGLE);
....................
.................... return(max);
.................... }
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_stall_ep(int8 endpoint)
.................... {
.................... int1 direction;
....................
.................... direction = bit_test(endpoint,7);
*
09B4: MOVLB 6
09B6: BCF xFE.0
09B8: BTFSC xFD.7
09BA: BSF xFE.0
.................... endpoint &= 0x7F;
09BC: BCF xFD.7
....................
.................... if (direction)
09BE: BTFSS xFE.0
09C0: BRA 09FC
.................... {
.................... EP_BDxST_I(endpoint) = 0x84;
09C2: MOVLB 7
09C4: CLRF x49
09C6: MOVFF 6FD,748
09CA: CLRF x4B
09CC: MOVLW 08
09CE: MOVWF x4A
09D0: MOVLB 0
09D2: RCALL 02BA
09D4: MOVFF 02,700
09D8: MOVFF 01,6FF
09DC: MOVLW 04
09DE: MOVLB 6
09E0: ADDWF xFF,F
09E2: MOVLW 00
09E4: MOVLB 7
09E6: ADDWFC x00,F
09E8: MOVFF 6FF,FE9
09EC: MOVLW 04
09EE: MOVLB 7
09F0: ADDWF x00,W
09F2: MOVWF FEA
09F4: MOVLW 84
09F6: MOVWF FEF
.................... }
.................... else
09F8: BRA 0A1E
09FA: MOVLB 6
.................... {
.................... EP_BDxST_O(endpoint) = 0x84;
09FC: MOVLB 7
09FE: CLRF x49
0A00: MOVFF 6FD,748
0A04: CLRF x4B
0A06: MOVLW 08
0A08: MOVWF x4A
0A0A: MOVLB 0
0A0C: RCALL 02BA
0A0E: MOVFF 01,FE9
0A12: MOVLW 04
0A14: MOVLB 7
0A16: ADDWF 02,W
0A18: MOVWF FEA
0A1A: MOVLW 84
0A1C: MOVWF FEF
.................... }
.................... }
0A1E: MOVLB 0
0A20: GOTO 0AD6 (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_unstall_ep(int8 endpoint)
.................... {
.................... int1 direction;
....................
.................... direction = bit_test(endpoint,7);
*
0946: MOVLB 6
0948: BCF xFE.0
094A: BTFSC xFD.7
094C: BSF xFE.0
.................... endpoint &= 0x7F;
094E: BCF xFD.7
....................
.................... if (direction)
0950: BTFSS xFE.0
0952: BRA 098E
.................... {
.................... #if USB_IGNORE_RX_DTS
.................... EP_BDxST_I(endpoint) = 0x80;
.................... #else
.................... EP_BDxST_I(endpoint) = 0x88;
0954: MOVLB 7
0956: CLRF x49
0958: MOVFF 6FD,748
095C: CLRF x4B
095E: MOVLW 08
0960: MOVWF x4A
0962: MOVLB 0
0964: RCALL 02BA
0966: MOVFF 02,700
096A: MOVFF 01,6FF
096E: MOVLW 04
0970: MOVLB 6
0972: ADDWF xFF,F
0974: MOVLW 00
0976: MOVLB 7
0978: ADDWFC x00,F
097A: MOVFF 6FF,FE9
097E: MOVLW 04
0980: MOVLB 7
0982: ADDWF x00,W
0984: MOVWF FEA
0986: MOVLW 88
0988: MOVWF FEF
.................... #endif
.................... }
.................... else
098A: BRA 09AE
098C: MOVLB 6
.................... {
.................... EP_BDxST_O(endpoint) = 0x00;
098E: MOVLB 7
0990: CLRF x49
0992: MOVFF 6FD,748
0996: CLRF x4B
0998: MOVLW 08
099A: MOVWF x4A
099C: MOVLB 0
099E: RCALL 02BA
09A0: MOVFF 01,FE9
09A4: MOVLW 04
09A6: MOVLB 7
09A8: ADDWF 02,W
09AA: MOVWF FEA
09AC: CLRF FEF
.................... }
.................... }
09AE: MOVLB 0
09B0: GOTO 0AC6 (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... int1 usb_endpoint_stalled(int8 endpoint)
.................... {
.................... int1 direction;
.................... int8 st;
....................
.................... direction = bit_test(endpoint,7);
*
0A24: MOVLB 6
0A26: BCF xFE.0
0A28: BTFSC xFD.7
0A2A: BSF xFE.0
.................... endpoint &= 0x7F;
0A2C: BCF xFD.7
....................
.................... if (direction)
0A2E: BTFSS xFE.0
0A30: BRA 0A68
.................... {
.................... st=EP_BDxST_I(endpoint);
0A32: MOVLB 7
0A34: CLRF x49
0A36: MOVFF 6FD,748
0A3A: CLRF x4B
0A3C: MOVLW 08
0A3E: MOVWF x4A
0A40: MOVLB 0
0A42: RCALL 02BA
0A44: MOVFF 02,701
0A48: MOVFF 01,700
0A4C: MOVLW 04
0A4E: MOVLB 7
0A50: ADDWF x00,F
0A52: MOVLW 00
0A54: ADDWFC x01,F
0A56: MOVFF 700,FE9
0A5A: MOVLW 04
0A5C: ADDWF x01,W
0A5E: MOVWF FEA
0A60: MOVFF FEF,6FF
0A64: MOVLB 6
.................... }
.................... else
0A66: BRA 0A8C
.................... {
.................... st=EP_BDxST_O(endpoint);
0A68: MOVLB 7
0A6A: CLRF x49
0A6C: MOVFF 6FD,748
0A70: CLRF x4B
0A72: MOVLW 08
0A74: MOVWF x4A
0A76: MOVLB 0
0A78: RCALL 02BA
0A7A: MOVLB 7
0A7C: MOVFF 01,FE9
0A80: MOVLW 04
0A82: ADDWF 02,W
0A84: MOVWF FEA
0A86: MOVFF FEF,6FF
0A8A: MOVLB 6
.................... }
....................
.................... return(bit_test(st,7) && bit_test(st,2));
0A8C: BTFSS xFF.7
0A8E: BRA 0A94
0A90: BTFSC xFF.2
0A92: BRA 0A98
0A94: MOVLW 00
0A96: BRA 0A9A
0A98: MOVLW 01
0A9A: MOVWF 01
.................... }
0A9C: MOVLB 0
0A9E: GOTO 0AEE (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_set_address(int8 address)
.................... {
.................... UADDR = address;
*
0F60: MOVFF 6FE,F6E
....................
.................... if (address)
0F64: MOVLB 6
0F66: MOVF xFE,F
0F68: BZ 0F70
.................... {
.................... usb_state = USB_STATE_ADDRESS;
0F6A: MOVLW 04
0F6C: MOVWF 24
.................... }
.................... else
0F6E: BRA 0F74
.................... {
.................... usb_state = USB_STATE_POWERED;
0F70: MOVLW 02
0F72: MOVWF 24
.................... }
.................... }
0F74: MOVLB 0
0F76: GOTO 0F84 (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_set_configured(int8 config)
.................... {
.................... int8 en;
.................... int16 addy;
.................... int8 new_uep;
.................... int16 len;
.................... int8 i;
....................
.................... if (config == 0)
*
055C: MOVLB 6
055E: MOVF xFD,F
0560: BNZ 056E
.................... {
.................... // if config=0 then set addressed state
.................... usb_state = USB_STATE_ADDRESS;
0562: MOVLW 04
0564: MOVWF 24
.................... usb_disable_endpoints();
0566: MOVLB 0
0568: RCALL 033E
.................... }
.................... else
056A: BRA 0786
056C: MOVLB 6
.................... {
.................... // else set configed state
.................... usb_state = USB_STATE_CONFIGURED;
056E: MOVLW 05
0570: MOVWF 24
.................... addy = (int16)USB_DATA_BUFFER_LOCATION+(2*USB_MAX_EP0_PACKET_LENGTH);
0572: MOVLW 04
0574: MOVLB 7
0576: MOVWF x00
0578: MOVLW 98
057A: MOVLB 6
057C: MOVWF xFF
.................... for (en=1; en<16; en++)
057E: MOVLW 01
0580: MOVWF xFE
0582: MOVF xFE,W
0584: SUBLW 0F
0586: BTFSS FD8.0
0588: BRA 0786
.................... {
.................... // enable and config endpoints based upon user configuration
.................... usb_disable_endpoint(en);
058A: MOVFF 6FE,706
058E: MOVLB 0
0590: RCALL 02DC
.................... new_uep = 0;
0592: MOVLB 7
0594: CLRF x01
.................... if (usb_ep_rx_type[en] != USB_ENABLE_DISABLED)
0596: CLRF 03
0598: MOVLB 6
059A: MOVF xFE,W
059C: MOVFF FF2,705
05A0: BCF FF2.7
05A2: MOVLB 0
05A4: RCALL 00CA
05A6: MOVLB 7
05A8: BTFSC x05.7
05AA: BSF FF2.7
05AC: SUBLW FF
05AE: BZ 0692
.................... {
.................... new_uep = 0x04;
05B0: MOVLW 04
05B2: MOVWF x01
.................... len = usb_ep_rx_size[en];
05B4: BCF FD8.0
05B6: MOVLB 6
05B8: RLCF xFE,W
05BA: CLRF 03
05BC: MOVFF FF2,705
05C0: BCF FF2.7
05C2: MOVLB 0
05C4: RCALL 011A
05C6: TBLRD*+
05C8: MOVFF FF5,03
05CC: MOVLB 7
05CE: BTFSC x05.7
05D0: BSF FF2.7
05D2: MOVWF x02
05D4: MOVFF 03,703
.................... EP_BDxCNT_O(en) = len;
05D8: CLRF x49
05DA: MOVFF 6FE,748
05DE: CLRF x4B
05E0: MOVLW 08
05E2: MOVWF x4A
05E4: MOVLB 0
05E6: RCALL 02BA
05E8: MOVFF 01,705
05EC: MOVLW 01
05EE: MOVLB 7
05F0: ADDWF 01,W
05F2: MOVWF 01
05F4: MOVLW 00
05F6: ADDWFC 02,W
05F8: MOVWF 03
05FA: MOVFF 01,FE9
05FE: MOVLW 04
0600: ADDWF 03,W
0602: MOVWF FEA
0604: MOVFF 702,FEF
.................... EP_BDxADR_O(en) = addy;
0608: CLRF x49
060A: MOVFF 6FE,748
060E: CLRF x4B
0610: MOVLW 08
0612: MOVWF x4A
0614: MOVLB 0
0616: RCALL 02BA
0618: MOVFF 01,705
061C: MOVLW 02
061E: MOVLB 7
0620: ADDWF 01,W
0622: MOVWF 01
0624: MOVLW 00
0626: ADDWFC 02,W
0628: MOVWF 03
062A: MOVFF 01,FE9
062E: MOVLW 04
0630: ADDWF 03,W
0632: MOVWF FEA
0634: MOVFF 700,FEC
0638: MOVF FED,F
063A: MOVFF 6FF,FEF
.................... addy += usb_ep_rx_size[en];
063E: BCF FD8.0
0640: MOVLB 6
0642: RLCF xFE,W
0644: CLRF 03
0646: MOVFF FF2,705
064A: BCF FF2.7
064C: MOVLB 0
064E: RCALL 011A
0650: TBLRD*+
0652: MOVFF FF5,03
0656: MOVLB 7
0658: BTFSC x05.7
065A: BSF FF2.7
065C: MOVLB 6
065E: ADDWF xFF,F
0660: MOVF 03,W
0662: MOVLB 7
0664: ADDWFC x00,F
.................... #if USB_IGNORE_RX_DTS
.................... i = 0x80;
.................... #else
.................... i = 0x88;
0666: MOVLW 88
0668: MOVWF x04
.................... #endif
.................... if (bit_test(len,8)) {bit_set(i,0);}
066A: BTFSC x03.0
066C: BSF x04.0
.................... if (bit_test(len,9)) {bit_set(i,1);}
066E: BTFSC x03.1
0670: BSF x04.1
.................... EP_BDxST_O(en) = i;
0672: CLRF x49
0674: MOVFF 6FE,748
0678: CLRF x4B
067A: MOVLW 08
067C: MOVWF x4A
067E: MOVLB 0
0680: RCALL 02BA
0682: MOVLB 7
0684: MOVFF 01,FE9
0688: MOVLW 04
068A: ADDWF 02,W
068C: MOVWF FEA
068E: MOVFF 704,FEF
.................... }
.................... if (usb_ep_tx_type[en] != USB_ENABLE_DISABLED)
0692: CLRF 03
0694: MOVLB 6
0696: MOVF xFE,W
0698: MOVFF FF2,705
069C: BCF FF2.7
069E: MOVLB 0
06A0: RCALL 00AA
06A2: MOVLB 7
06A4: BTFSC x05.7
06A6: BSF FF2.7
06A8: SUBLW FF
06AA: BZ 0748
.................... {
.................... new_uep |= 0x02;
06AC: BSF x01.1
.................... EP_BDxADR_I(en) = addy;
06AE: CLRF x49
06B0: MOVFF 6FE,748
06B4: CLRF x4B
06B6: MOVLW 08
06B8: MOVWF x4A
06BA: MOVLB 0
06BC: RCALL 02BA
06BE: MOVFF 02,706
06C2: MOVFF 01,705
06C6: MOVLW 04
06C8: MOVLB 7
06CA: ADDWF x05,F
06CC: MOVLW 00
06CE: ADDWFC x06,F
06D0: MOVLW 02
06D2: ADDWF x05,W
06D4: MOVWF 01
06D6: MOVLW 00
06D8: ADDWFC x06,W
06DA: MOVWF 03
06DC: MOVFF 01,FE9
06E0: MOVLW 04
06E2: ADDWF 03,W
06E4: MOVWF FEA
06E6: MOVFF 700,FEC
06EA: MOVF FED,F
06EC: MOVFF 6FF,FEF
.................... addy += usb_ep_tx_size[en];
06F0: BCF FD8.0
06F2: MOVLB 6
06F4: RLCF xFE,W
06F6: CLRF 03
06F8: MOVFF FF2,705
06FC: BCF FF2.7
06FE: MOVLB 0
0700: RCALL 00EA
0702: TBLRD*+
0704: MOVFF FF5,03
0708: MOVLB 7
070A: BTFSC x05.7
070C: BSF FF2.7
070E: MOVLB 6
0710: ADDWF xFF,F
0712: MOVF 03,W
0714: MOVLB 7
0716: ADDWFC x00,F
.................... EP_BDxST_I(en) = 0x40;
0718: CLRF x49
071A: MOVFF 6FE,748
071E: CLRF x4B
0720: MOVLW 08
0722: MOVWF x4A
0724: MOVLB 0
0726: RCALL 02BA
0728: MOVFF 02,706
072C: MOVFF 01,705
0730: MOVLW 04
0732: MOVLB 7
0734: ADDWF x05,F
0736: MOVLW 00
0738: ADDWFC x06,F
073A: MOVFF 705,FE9
073E: MOVLW 04
0740: ADDWF x06,W
0742: MOVWF FEA
0744: MOVLW 40
0746: MOVWF FEF
.................... }
.................... if (new_uep == 0x06) {new_uep = 0x0E;}
0748: MOVF x01,W
074A: SUBLW 06
074C: BNZ 0752
074E: MOVLW 0E
0750: MOVWF x01
.................... if (usb_ep_tx_type[en] != USB_ENABLE_ISOCHRONOUS) {new_uep |= 0x10;}
0752: CLRF 03
0754: MOVLB 6
0756: MOVF xFE,W
0758: MOVFF FF2,705
075C: BCF FF2.7
075E: MOVLB 0
0760: RCALL 00AA
0762: MOVLB 7
0764: BTFSC x05.7
0766: BSF FF2.7
0768: SUBLW 01
076A: BTFSS FD8.2
076C: BSF x01.4
....................
.................... UEP(en) = new_uep;
076E: CLRF 03
0770: MOVLB 6
0772: MOVF xFE,W
0774: ADDLW 70
0776: MOVWF FE9
0778: MOVLW 0F
077A: ADDWFC 03,W
077C: MOVWF FEA
077E: MOVFF 701,FEF
.................... }
0782: INCF xFE,F
0784: BRA 0582
0786: MOVLB 0
.................... }
.................... }
0788: GOTO 082C (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_disable_endpoint(int8 en)
.................... {
.................... UEP(en) = ENDPT_DISABLED;
*
02DC: CLRF 03
02DE: MOVLB 7
02E0: MOVF x06,W
02E2: ADDLW 70
02E4: MOVWF FE9
02E6: MOVLW 0F
02E8: ADDWFC 03,W
02EA: MOVWF FEA
02EC: CLRF FEF
.................... EP_BDxST_O(en) = 0; //clear state, deque if necessary
02EE: CLRF x49
02F0: MOVFF 706,748
02F4: CLRF x4B
02F6: MOVLW 08
02F8: MOVWF x4A
02FA: MOVLB 0
02FC: RCALL 02BA
02FE: MOVLB 7
0300: MOVFF 01,FE9
0304: MOVLW 04
0306: ADDWF 02,W
0308: MOVWF FEA
030A: CLRF FEF
.................... EP_BDxST_I(en) = 0; //clear state, deque if necessary
030C: CLRF x49
030E: MOVFF 706,748
0312: CLRF x4B
0314: MOVLW 08
0316: MOVWF x4A
0318: MOVLB 0
031A: RCALL 02BA
031C: MOVFF 02,708
0320: MOVFF 01,707
0324: MOVLW 04
0326: MOVLB 7
0328: ADDWF x07,F
032A: MOVLW 00
032C: ADDWFC x08,F
032E: MOVFF 707,FE9
0332: MOVLW 04
0334: ADDWF x08,W
0336: MOVWF FEA
0338: CLRF FEF
.................... }
033A: MOVLB 0
033C: RETLW 00
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_disable_endpoints(void)
.................... {
.................... int8 i;
....................
.................... for (i=1; i<16; i++)
033E: MOVLW 01
0340: MOVLB 7
0342: MOVWF x05
0344: MOVF x05,W
0346: SUBLW 0F
0348: BNC 0358
.................... usb_disable_endpoint(i);
034A: MOVFF 705,706
034E: MOVLB 0
0350: RCALL 02DC
0352: MOVLB 7
0354: INCF x05,F
0356: BRA 0344
....................
.................... //__usb_kbhit_status=0;
.................... }
0358: MOVLB 0
035A: RETLW 00
....................
.................... /// END Hardware layer functions required by USB.C
....................
....................
.................... /// BEGIN USB Interrupt Service Routine
....................
.................... static void usb_clear_trn(void)
.................... {
.................... UIR_TRN = 0;
*
03AA: BCF F68.3
.................... delay_cycles(6);
03AC: BRA 03AE
03AE: BRA 03B0
03B0: BRA 03B2
.................... }
03B2: RETLW 00
....................
.................... /*****************************************************************************
.................... /* usb_handle_interrupt()
.................... /*
.................... /* Summary: Checks the interrupt, and acts upon event. Processing finished
.................... /* tokens is the majority of this code, and is handled by usb.c
.................... /*
.................... /* NOTE: If you wish to change to a polling method (and not an interrupt
.................... /* method), then you must call this function rapidly. If there is more
.................... /* than 10ms latency the PC may think the USB device is stalled and
.................... /* disable it.
.................... /* To switch to a polling method, remove the #int_usb line above this
.................... /* fuction. Also, goto usb_init() and remove the code that enables the
.................... /* USB interrupt.
.................... /******************************************************************************/
.................... #int_usb
.................... void usb_isr()
.................... {
.................... int8 TRNAttempts;
....................
.................... if (usb_state == USB_STATE_DETACHED) return; //should never happen, though
*
1274: MOVF 24,F
1276: BNZ 127A
1278: BRA 12EE
.................... if (UIR)
127A: MOVF F68,F
127C: BZ 12EE
.................... {
.................... debug_usb(debug_putc,"\r\n\n[%X] ",UIR);
....................
.................... //activity detected. (only enable after sleep)
.................... if (UIR_ACTV && UIE_ACTV) {usb_isr_activity();}
127E: BTFSS F68.2
1280: BRA 128A
1282: BTFSS F69.2
1284: BRA 128A
1286: GOTO 0274
....................
.................... if (UCON_SUSPND) return;
128A: BTFSS F6D.1
128C: BRA 1290
128E: BRA 12EE
....................
.................... if (UIR_STALL && UIE_STALL) {usb_isr_stall();} //a stall handshake was sent
1290: BTFSS F68.5
1292: BRA 129C
1294: BTFSS F69.5
1296: BRA 129C
1298: GOTO 02A4
....................
.................... if (UIR_UERR && UIE_UERR) {usb_isr_uerr();} //error has been detected
129C: BTFSS F68.1
129E: BRA 12A8
12A0: BTFSS F69.1
12A2: BRA 12A8
12A4: GOTO 02B2
....................
.................... if (UIR_URST && UIE_URST) {usb_isr_rst();} //usb reset has been detected
12A8: BTFSS F68.0
12AA: BRA 12B4
12AC: BTFSS F69.0
12AE: BRA 12B4
12B0: GOTO 03B4
....................
.................... if (UIR_IDLE && UIE_IDLE) {usb_isr_uidle();} //idle time, we can go to sleep
12B4: BTFSS F68.4
12B6: BRA 12C0
12B8: BTFSS F69.4
12BA: BRA 12C0
12BC: GOTO 03DE
....................
.................... if (UIR_SOF && UIE_SOF) {usb_isr_sof();}
12C0: BTFSS F68.6
12C2: BRA 12CC
12C4: BTFSS F69.6
12C6: BRA 12CC
12C8: GOTO 03E8
....................
.................... TRNAttempts = 0;
12CC: MOVLB 6
12CE: CLRF xFA
.................... do
.................... {
.................... if (UIR_TRN && UIE_TRN)
12D0: BTFSS F68.3
12D2: BRA 12E0
12D4: BTFSS F69.3
12D6: BRA 12E0
.................... {
.................... usb_isr_tok_dne();
12D8: MOVLB 0
12DA: BRA 108A
.................... }
.................... else
12DC: BRA 12E2
12DE: MOVLB 6
.................... break;
12E0: BRA 12EC
.................... } while (TRNAttempts++ < 4);
12E2: MOVLB 6
12E4: MOVF xFA,W
12E6: INCF xFA,F
12E8: SUBLW 03
12EA: BC 12D0
12EC: MOVLB 0
.................... }
.................... }
....................
.................... // SOF interrupt not handled. user must add this depending on application
12EE: BCF FA1.5
12F0: GOTO 0064
.................... void usb_isr_sof(void)
.................... {
.................... debug_usb(debug_putc, "\r\nSOF");
....................
.................... UIR_SOF = 0;
*
03E8: BCF F68.6
.................... }
03EA: GOTO 12CC (RETURN)
....................
.................... /*****************************************************************************
.................... /* usb_isr_rst()
.................... /*
.................... /* Summary: The host (computer) sent us a RESET command. Reset USB device
.................... /* and token handler code to initial state.
.................... /*
.................... /******************************************************************************/
.................... void usb_isr_rst(void)
.................... {
.................... debug_usb(debug_putc,"R");
....................
.................... UEIR = 0;
*
03B4: CLRF F6A
.................... UIR = 0;
03B6: CLRF F68
.................... UEIE = 0x9F;
03B8: MOVLW 9F
03BA: MOVWF F6B
.................... UIE = STANDARD_INTS & ~__USB_UIF_ACTIVE;
03BC: MOVLW 3D
03BE: MOVWF F69
....................
.................... UADDR = 0;
03C0: CLRF F6E
....................
.................... usb_disable_endpoints();
03C2: RCALL 033E
....................
.................... usb_token_reset();
03C4: RCALL 037E
....................
.................... UEP(0) = ENDPT_CONTROL | 0x10;
03C6: MOVLW 16
03C8: MOVWF F70
....................
.................... while (UIR_TRN)
.................... {
03CA: BTFSS F68.3
03CC: BRA 03D2
.................... usb_clear_trn();
03CE: RCALL 03AA
.................... }
03D0: BRA 03CA
....................
.................... UCON_PKTDIS = 0; //SIE token and packet processing enabled
03D2: BCF F6D.4
....................
.................... usb_init_ep0_setup();
03D4: RCALL 0284
....................
.................... usb_state = USB_STATE_DEFAULT; //put usb mcu into default state
03D6: MOVLW 03
03D8: MOVWF 24
.................... }
03DA: GOTO 12B4 (RETURN)
....................
.................... /*****************************************************************************
.................... /* usb_init_ep0_setup()
.................... /*
.................... /* Summary: Configure EP0 to receive setup packets
.................... /*
.................... /*****************************************************************************/
.................... void usb_init_ep0_setup(void)
.................... {
.................... EP_BDxCNT_O(0) = USB_MAX_EP0_PACKET_LENGTH;
*
0284: MOVLW 40
0286: MOVLB 4
0288: MOVWF x01
.................... EP_BDxADR_O(0) = USB_DATA_BUFFER_LOCATION;
028A: MOVLW 04
028C: MOVWF x03
028E: MOVLW 18
0290: MOVWF x02
.................... #if USB_IGNORE_RX_DTS
.................... EP_BDxST_O(0) = 0x80; //give control to SIE, data toggle synch off
.................... #else
.................... EP_BDxST_O(0) = 0x88; //give control to SIE, DATA0, data toggle synch on
0292: MOVLW 88
0294: MOVWF x00
.................... #endif
....................
.................... EP_BDxST_I(0) = 0;
0296: CLRF x04
.................... EP_BDxADR_I(0) = USB_DATA_BUFFER_LOCATION + (int16)USB_MAX_EP0_PACKET_LENGTH;
0298: MOVLW 04
029A: MOVWF x07
029C: MOVLW 58
029E: MOVWF x06
.................... }
02A0: MOVLB 0
02A2: RETLW 00
....................
.................... /*******************************************************************************
.................... /* usb_isr_uerr()
.................... /*
.................... /* Summary: The USB peripheral had an error. If user specified, error counter
.................... /* will incerement. If having problems check the status of these 8 bytes.
.................... /*
.................... /* NOTE: This code is not enabled by default.
.................... /********************************************************************************/
.................... void usb_isr_uerr(void)
.................... {
.................... #if USB_USE_ERROR_COUNTER
.................... int ints;
.................... #endif
....................
.................... debug_usb(debug_putc,"E %X ",UEIR);
....................
.................... #if USB_USE_ERROR_COUNTER
.................... ints=UEIR & UEIE; //mask off the flags with the ones that are enabled
....................
.................... if ( bit_test(ints,0) )
.................... {
.................... //increment pid_error counter
.................... debug_usb(debug_putc,"PID ");
.................... ERROR_COUNTER[0]++;
.................... }
....................
.................... if ( bit_test(ints,1) )
.................... {
.................... //increment crc5 error counter
.................... debug_usb(debug_putc,"CRC5 ");
.................... ERROR_COUNTER[1]++;
.................... }
....................
.................... if ( bit_test(ints,2) )
.................... {
.................... //increment crc16 error counter
.................... debug_usb(debug_putc,"CRC16 ");
.................... ERROR_COUNTER[2]++;
.................... }
....................
.................... if ( bit_test(ints,3) )
.................... {
.................... //increment dfn8 error counter
.................... debug_usb(debug_putc,"DFN8 ");
.................... ERROR_COUNTER[3]++;
.................... }
....................
.................... if ( bit_test(ints,4) )
.................... {
.................... //increment bto error counter
.................... debug_usb(debug_putc,"BTO ");
.................... ERROR_COUNTER[4]++;
.................... }
....................
.................... if ( bit_test(ints,7) )
.................... {
.................... //increment bts error counter
.................... debug_usb(debug_putc,"BTS ");
.................... ERROR_COUNTER[5]++;
.................... }
.................... #endif
....................
.................... UEIR = 0;
*
02B2: CLRF F6A
.................... UIR_UERR = 0;
02B4: BCF F68.1
.................... }
02B6: GOTO 12A8 (RETURN)
....................
.................... /*****************************************************************************
.................... /* usb_isr_uidle()
.................... /*
.................... /* Summary: USB peripheral detected IDLE. Put the USB peripheral to sleep.
.................... /*
.................... /*****************************************************************************/
.................... void usb_isr_uidle(void)
.................... {
.................... debug_usb(debug_putc, "I");
....................
.................... UIE_ACTV = 1; //enable activity interrupt flag. (we are now suspended until we get an activity interrupt. nice)
*
03DE: BSF F69.2
.................... UIR_IDLE = 0; //clear idle interrupt flag
03E0: BCF F68.4
.................... UCON_SUSPND = 1; //set suspend. we are now suspended
03E2: BSF F6D.1
.................... }
03E4: GOTO 12C0 (RETURN)
....................
....................
.................... /******************************************************************************
.................... /* usb_isr_activity()
.................... /*
.................... /* Summary: USB peripheral detected activity on the USB device. Wake-up the USB
.................... /* peripheral.
.................... /*
.................... /*****************************************************************************/
.................... void usb_isr_activity(void)
.................... {
.................... debug_usb(debug_putc, "A");
....................
.................... UCON_SUSPND = 0; //turn off low power suspending
*
0274: BCF F6D.1
.................... UIE_ACTV = 0; //clear activity interupt enabling
0276: BCF F69.2
....................
.................... while(UIR_ACTV)
.................... UIR_ACTV = 0;
0278: BTFSS F68.2
027A: BRA 0280
027C: BCF F68.2
027E: BRA 0278
.................... }
0280: GOTO 128A (RETURN)
....................
.................... /******************************************************************************
.................... /* usb_isr_stall()
.................... /*
.................... /* Summary: Stall handshake detected.
.................... /*
.................... /*****************************************************************************/
.................... void usb_isr_stall(void)
.................... {
.................... debug_usb(debug_putc, "S");
....................
....................
.................... if (bit_test(UEP(0),0))
*
02A4: BTFSS F70.0
02A6: BRA 02AC
.................... {
.................... usb_init_ep0_setup();
02A8: RCALL 0284
.................... bit_clear(UEP(0), 0);
02AA: BCF F70.0
.................... }
....................
.................... UIR_STALL = 0;
02AC: BCF F68.5
.................... }
02AE: GOTO 129C (RETURN)
....................
.................... // see usb_hw_layer.h for documentation
.................... void usb_request_send_response(unsigned int8 len) {__setup_0_tx_size = len;}
*
03EE: MOVFF 700,25
03F2: RETLW 00
.................... void usb_request_get_data(void) {__setup_0_tx_size = 0xFE;}
*
0B0C: MOVLW FE
0B0E: MOVWF 25
0B10: RETLW 00
.................... void usb_request_stall(void) {__setup_0_tx_size = 0xFF;}
*
03F4: MOVLW FF
03F6: MOVWF 25
03F8: RETLW 00
....................
.................... /*****************************************************************************
.................... /* usb_isr_tok_dne()
.................... /*
.................... /* Summary: A Token (IN/OUT/SETUP) has been received by the USB peripheral.
.................... /* If a setup token on EP0 was received, run the chapter 9 code and
.................... /* handle the request.
.................... /* If an IN token on EP0 was received, continue transmitting any
.................... /* unfinished requests that may take more than one packet to transmit
.................... /* (if necessary).
.................... /* If an OUT token on any other EP was received, mark that EP as ready
.................... /* for a usb_get_packet().
.................... /* Does not handle any IN or OUT tokens on EP0.
.................... /*
.................... /*****************************************************************************/
.................... void usb_isr_tok_dne(void)
.................... {
.................... int8 en;
....................
.................... en = USTAT>>3;
*
108A: RRCF F6C,W
108C: MOVLB 6
108E: MOVWF xFB
1090: RRCF xFB,F
1092: RRCF xFB,F
1094: MOVLW 1F
1096: ANDWF xFB,F
....................
.................... debug_usb(debug_putc, "T ");
.................... debug_usb(debug_putc, "%X ", USTAT);
....................
.................... if (USTAT == USTAT_OUT_SETUP_E0)
1098: MOVF F6C,F
109A: BNZ 1138
.................... {
.................... //new out or setup token in the buffer
.................... int8 pidKey;
....................
.................... debug_usb(debug_putc,"%X ", EP_BDxST_O(0));
....................
.................... pidKey = EP_BDxST_O(0) & 0x3C; //save PID
109C: MOVLB 4
109E: MOVF x00,W
10A0: ANDLW 3C
10A2: MOVLB 6
10A4: MOVWF xFC
....................
.................... EP_BDxST_O(0) &= 0x43; //clear pid, prevent bdstal/pid confusion
10A6: MOVLW 43
10A8: MOVLB 4
10AA: ANDWF x00,F
.................... usb_clear_trn();
10AC: MOVLB 0
10AE: CALL 03AA
....................
.................... if (pidKey == USB_PIC_PID_SETUP)
10B2: MOVLB 6
10B4: MOVF xFC,W
10B6: SUBLW 34
10B8: BNZ 10FE
.................... {
.................... EP_BDxST_I(0)=0; // return the in buffer to us (dequeue any pending requests)
10BA: MOVLB 4
10BC: CLRF x04
....................
.................... debug_usb(debug_putc,"(%U) ", EP_BDxCNT_O(0));
.................... debug_display_ram(EP_BDxCNT_O(0), usb_ep0_rx_buffer);
....................
.................... usb_isr_tok_setup_dne();
10BE: MOVLB 0
10C0: BRA 0BC0
....................
.................... UCON_PKTDIS=0; // UCON,PKT_DIS ; Assuming there is nothing to dequeue, clear the packet disable bit
10C2: BCF F6D.4
....................
.................... //if setup_0_tx_size==0xFF - stall ep0 (unhandled request) (see usb_request_stall())
.................... //if setup_0_tx_size==0xFE - get EP0OUT ready for a data packet, leave EP0IN alone (see usb_request_get_data())
.................... //else setup_0_tx_size=size of response, get EP0OUT ready for a setup packet, mark EPOIN ready for transmit (see usb_request_send_response())
.................... if (__setup_0_tx_size == 0xFF)
10C4: INCFSZ 25,W
10C6: BRA 10D6
.................... usb_flush_out(0, USB_DTS_STALL);
10C8: MOVLB 6
10CA: CLRF xFD
10CC: MOVLW 03
10CE: MOVWF xFE
10D0: MOVLB 0
10D2: RCALL 0BEA
.................... else
10D4: BRA 10FA
.................... {
.................... usb_flush_out(0, USB_DTS_TOGGLE);
10D6: MOVLB 6
10D8: CLRF xFD
10DA: MOVLW 02
10DC: MOVWF xFE
10DE: MOVLB 0
10E0: RCALL 0BEA
.................... if (__setup_0_tx_size != 0xFE)
10E2: MOVF 25,W
10E4: SUBLW FE
10E6: BZ 10FA
.................... usb_flush_in(0 ,__setup_0_tx_size, USB_DTS_USERX);
10E8: MOVLB 7
10EA: CLRF x42
10EC: CLRF x44
10EE: MOVFF 25,743
10F2: MOVLW 04
10F4: MOVWF x45
10F6: MOVLB 0
10F8: RCALL 0D5C
.................... }
.................... //why was this here?
.................... //UCON_PKTDIS=0; // UCON,PKT_DIS ; Assuming there is nothing to dequeue, clear the packet disable bit
.................... }
.................... else if (pidKey == USB_PIC_PID_OUT)
10FA: BRA 1134
10FC: MOVLB 6
10FE: MOVF xFC,W
1100: SUBLW 04
1102: BNZ 1136
.................... {
.................... usb_isr_tok_out_dne(0);
1104: CLRF xFD
1106: MOVLB 0
1108: RCALL 0F42
.................... usb_flush_out(0, USB_DTS_TOGGLE);
110A: MOVLB 6
110C: CLRF xFD
110E: MOVLW 02
1110: MOVWF xFE
1112: MOVLB 0
1114: RCALL 0BEA
.................... if ((__setup_0_tx_size!=0xFE) && (__setup_0_tx_size!=0xFF))
1116: MOVF 25,W
1118: SUBLW FE
111A: BZ 1134
111C: INCFSZ 25,W
111E: BRA 1122
1120: BRA 1134
.................... {
.................... usb_flush_in(0,__setup_0_tx_size,USB_DTS_DATA1); //send response (usually a 0len)
1122: MOVLB 7
1124: CLRF x42
1126: CLRF x44
1128: MOVFF 25,743
112C: MOVLW 01
112E: MOVWF x45
1130: MOVLB 0
1132: RCALL 0D5C
1134: MOVLB 6
.................... }
.................... }
.................... }
.................... else if (USTAT == USTAT_IN_E0)
1136: BRA 126E
1138: MOVF F6C,W
113A: SUBLW 04
113C: BNZ 1178
.................... {
.................... //pic -> host transfer completed
.................... EP_BDxST_I(0) = EP_BDxST_I(0) & 0x43; //clear up any BDSTAL confusion
113E: MOVLW 43
1140: MOVLB 4
1142: ANDWF x04,F
.................... usb_clear_trn();
1144: MOVLB 0
1146: CALL 03AA
.................... __setup_0_tx_size = 0xFF;
114A: MOVLW FF
114C: MOVWF 25
.................... usb_isr_tok_in_dne(0);
114E: MOVLB 6
1150: CLRF xFD
1152: MOVLB 0
1154: RCALL 1058
.................... if (__setup_0_tx_size!=0xFF)
1156: INCFSZ 25,W
1158: BRA 115C
115A: BRA 1170
.................... usb_flush_in(0, __setup_0_tx_size, USB_DTS_TOGGLE);
115C: MOVLB 7
115E: CLRF x42
1160: CLRF x44
1162: MOVFF 25,743
1166: MOVLW 02
1168: MOVWF x45
116A: MOVLB 0
116C: RCALL 0D5C
.................... else
116E: BRA 1174
.................... usb_init_ep0_setup();
1170: CALL 0284
.................... }
.................... else
1174: BRA 126C
1176: MOVLB 6
.................... {
.................... if (!bit_test(USTAT, 2))
1178: BTFSC F6C.2
117A: BRA 11E6
.................... {
.................... EP_BDxST_O(en) = EP_BDxST_O(en) & 0x43; //clear up any BDSTAL confusion
117C: MOVLB 7
117E: CLRF x49
1180: MOVFF 6FB,748
1184: CLRF x4B
1186: MOVLW 08
1188: MOVWF x4A
118A: MOVLB 0
118C: CALL 02BA
1190: MOVFF 01,6FD
1194: MOVLB 6
1196: MOVFF 01,01
119A: MOVLW 04
119C: ADDWF 02,W
119E: MOVWF 03
11A0: MOVFF 01,6FD
11A4: MOVWF xFE
11A6: MOVLB 7
11A8: CLRF x49
11AA: MOVFF 6FB,748
11AE: CLRF x4B
11B0: MOVLW 08
11B2: MOVWF x4A
11B4: MOVLB 0
11B6: CALL 02BA
11BA: MOVFF 01,FE9
11BE: MOVLW 04
11C0: MOVLB 7
11C2: ADDWF 02,W
11C4: MOVWF FEA
11C6: MOVF FEF,W
11C8: ANDLW 43
11CA: MOVLB 6
11CC: MOVFF 6FE,FEA
11D0: MOVFF 6FD,FE9
11D4: MOVWF FEF
.................... usb_clear_trn();
11D6: MOVLB 0
11D8: CALL 03AA
.................... usb_isr_tok_out_dne(en);
11DC: MOVFF 6FB,6FD
11E0: RCALL 0F42
.................... }
.................... else
11E2: BRA 126C
11E4: MOVLB 6
.................... {
.................... EP_BDxST_I(en) = EP_BDxST_I(en) & 0x43; //clear up any BDSTAL confusion
11E6: MOVLB 7
11E8: CLRF x49
11EA: MOVFF 6FB,748
11EE: CLRF x4B
11F0: MOVLW 08
11F2: MOVWF x4A
11F4: MOVLB 0
11F6: CALL 02BA
11FA: MOVFF 02,6FE
11FE: MOVFF 01,6FD
1202: MOVLW 04
1204: MOVLB 6
1206: ADDWF xFD,F
1208: MOVLW 00
120A: ADDWFC xFE,F
120C: MOVFF 6FD,01
1210: MOVLW 04
1212: ADDWF xFE,W
1214: MOVWF 03
1216: MOVFF 6FD,6FD
121A: MOVWF xFE
121C: MOVLB 7
121E: CLRF x49
1220: MOVFF 6FB,748
1224: CLRF x4B
1226: MOVLW 08
1228: MOVWF x4A
122A: MOVLB 0
122C: CALL 02BA
1230: MOVFF 02,700
1234: MOVFF 01,6FF
1238: MOVLW 04
123A: MOVLB 6
123C: ADDWF xFF,F
123E: MOVLW 00
1240: MOVLB 7
1242: ADDWFC x00,F
1244: MOVFF 6FF,FE9
1248: MOVLW 04
124A: MOVLB 7
124C: ADDWF x00,W
124E: MOVWF FEA
1250: MOVF FEF,W
1252: ANDLW 43
1254: MOVLB 6
1256: MOVFF 6FE,FEA
125A: MOVFF 6FD,FE9
125E: MOVWF FEF
.................... usb_clear_trn();
1260: MOVLB 0
1262: CALL 03AA
.................... usb_isr_tok_in_dne(en);
1266: MOVFF 6FB,6FD
126A: RCALL 1058
126C: MOVLB 6
.................... }
.................... }
.................... }
126E: MOVLB 0
1270: GOTO 12DC (RETURN)
....................
.................... /// END USB Interrupt Service Routine
....................
.................... #ENDIF
....................
.................... #endif
....................
.................... #if defined(__PIC24_USB_H__)
.................... #include <pic24_usb.c>
.................... #endif
....................
.................... #if defined(__USBN960X_H__)
.................... #include <usbn960x.c>
.................... #endif
....................
....................
.................... #IFNDEF __USB_HARDWARE__
.................... #ERROR You must include USB hardware driver.
.................... #ENDIF
....................
.................... #IFNDEF __USB_DESCRIPTORS__
.................... #ERROR You must include USB descriptors.
.................... #ENDIF
....................
.................... TYPE_USB_STACK_STATUS USB_stack_status;
....................
.................... int8 USB_address_pending; //save previous state because packets can take several isrs
.................... int8 usb_getdesc_ptr; unsigned int8 usb_getdesc_len=0; //for reading string and config descriptors
....................
.................... #IF USB_HID_BOOT_PROTOCOL
.................... int8 hid_protocol[USB_NUM_HID_INTERFACES];
.................... #ENDIF
....................
.................... void usb_put_0len_0(void);
.................... void usb_match_registers(int8 endpoint, int16 *status, int16 *buffer, int8 *size);
....................
.................... void usb_isr_tkn_setup_StandardEndpoint(void);
.................... void usb_isr_tkn_setup_StandardDevice(void);
.................... void usb_isr_tkn_setup_StandardInterface(void);
.................... #IF USB_HID_DEVICE
.................... void usb_isr_tkn_setup_ClassInterface(void);
.................... #ENDIF
.................... void usb_Get_Descriptor(void);
.................... void usb_copy_desc_seg_to_ep(void);
.................... void usb_finish_set_address(void);
....................
.................... int8 USB_Interface[USB_MAX_NUM_INTERFACES]; //config state for all of our interfaces, NUM_INTERFACES defined with descriptors
....................
.................... /// BEGIN User Functions
....................
.................... // see usb.h for documentation
.................... int1 usb_enumerated(void)
.................... {
.................... return(USB_stack_status.curr_config);
.................... }
....................
.................... // see usb.h for documentation
.................... void usb_wait_for_enumeration(void)
.................... {
.................... while (USB_stack_status.curr_config == 0) {restart_wdt();}
.................... }
....................
.................... // see USB.H for documentation
.................... int1 usb_puts(int8 endpoint, int8 * ptr, unsigned int16 len, unsigned int8 timeout) {
.................... unsigned int16 i=0;
.................... int1 res;
.................... unsigned int16 this_packet_len;
.................... unsigned int16 packet_size;
.................... unsigned int32 timeout_1us;
....................
.................... packet_size = usb_ep_tx_size[endpoint];
....................
.................... //printf("\r\nUSB PUTS %U LEN=%LU MAX_PACK=%LU\r\n", endpoint, len, packet_size);
....................
.................... //send data packets until timeout or no more packets to send
.................... while (i < len)
.................... {
.................... timeout_1us = (int32)timeout*1000;
.................... if ((len - i) > packet_size) {this_packet_len = packet_size;}
.................... else {this_packet_len = len-i;}
.................... //putc('*');
.................... do
.................... {
.................... res = usb_put_packet(endpoint, ptr + i, this_packet_len, USB_DTS_TOGGLE); //send 64 byte packets
.................... //putc('.');
.................... if (!res)
.................... {
.................... delay_us(1);
.................... //delay_ms(500);
.................... timeout_1us--;
.................... }
.................... } while (!res && timeout_1us);
.................... i += packet_size;
.................... }
....................
....................
.................... //send 0len packet if needed
.................... if (i==len) {
.................... timeout_1us=(int32)timeout*1000;
.................... do {
.................... res = usb_put_packet(endpoint,0,0,USB_DTS_TOGGLE); //indicate end of message
.................... if (!res) {
.................... delay_us(1);
.................... timeout_1us--;
.................... }
.................... } while (!res && timeout_1us);
.................... }
....................
.................... return(res);
.................... }
....................
.................... // see usb.h for documentation
.................... unsigned int16 usb_gets(int8 endpoint, int8 * ptr, unsigned int16 max, unsigned int16 timeout) {
.................... unsigned int16 ret=0;
.................... unsigned int16 to;
.................... unsigned int16 len;
.................... unsigned int16 packet_size;
.................... unsigned int16 this_packet_max;
....................
.................... packet_size=usb_ep_rx_size[endpoint];
....................
.................... do {
.................... if (packet_size < max) {this_packet_max=packet_size;} else {this_packet_max=max;}
.................... to=0;
.................... do {
.................... if (usb_kbhit(endpoint)) {
.................... len=usb_get_packet(endpoint,ptr,this_packet_max);
.................... ptr+=len;
.................... max-=len;
.................... ret+=len;
.................... break;
.................... }
.................... else {
.................... to++;
.................... delay_ms(1);
.................... }
.................... } while (to!=timeout);
.................... } while ((len == packet_size) && (to!=timeout) && max);
....................
.................... return(ret);
.................... }
....................
.................... /// END User Functions
....................
....................
.................... /// BEGIN USB Token, standard and HID request handler (part of ISR)
....................
.................... // see usb.h for documentation
.................... void usb_token_reset(void)
.................... {
.................... unsigned int i;
....................
.................... for (i=0;i<USB_MAX_NUM_INTERFACES;i++)
*
037E: MOVLB 7
0380: CLRF x19
0382: MOVF x19,W
0384: SUBLW 01
0386: BNC 039C
.................... USB_Interface[i] = 0; //reset each interface to default
0388: CLRF 03
038A: MOVF x19,W
038C: ADDLW 29
038E: MOVWF FE9
0390: MOVLW 00
0392: ADDWFC 03,W
0394: MOVWF FEA
0396: CLRF FEF
....................
.................... #IF USB_HID_BOOT_PROTOCOL
.................... for (i=0;i<USB_NUM_HID_INTERFACES; i++)
.................... hid_protocol[i] = 1;
.................... #endif
....................
.................... #if USB_CDC_DEVICE
0398: INCF x19,F
039A: BRA 0382
.................... usb_cdc_init();
039C: MOVLB 0
039E: RCALL 035C
.................... #endif
....................
.................... USB_stack_status.curr_config = 0; //unconfigured device
03A0: CLRF 1E
....................
.................... USB_stack_status.status_device = 1; //previous state. init at none
03A2: MOVLW 01
03A4: MOVWF 1F
.................... USB_stack_status.dev_req = NONE; //previous token request state. init at none
03A6: CLRF 1D
.................... }
03A8: RETLW 00
....................
.................... //send a 0len packet to endpoint 0 (optimization)
.................... //notice that this doesnt return the status
.................... #define usb_put_0len_0() usb_request_send_response(0)
....................
.................... /**************************************************************
.................... /* usb_endpoint_is_valid(endpoint)
.................... /*
.................... /* Input: endpoint - endpoint to check.
.................... /* bit 7 is direction (set is IN, clear is OUT)
.................... /*
.................... /* Output: TRUE if endpoint is valid, FALSE if not
.................... /*
.................... /* Summary: Checks the dynamic configuration to see if requested
.................... /* endpoint is a valid endpoint.
.................... /***************************************************************/
.................... int1 usb_endpoint_is_valid(int8 endpoint)
.................... {
.................... int1 direction;
.................... direction = bit_test(endpoint,7);
*
08E8: MOVLB 6
08EA: BCF xFE.0
08EC: BTFSC xFD.7
08EE: BSF xFE.0
.................... endpoint &= 0x7F;
08F0: BCF xFD.7
.................... if (direction) { //IN
08F2: BTFSS xFE.0
08F4: BRA 091C
.................... return(usb_ep_tx_type[endpoint] != USB_ENABLE_DISABLED);
08F6: CLRF 03
08F8: MOVF xFD,W
08FA: MOVFF FF2,6FF
08FE: BCF FF2.7
0900: MOVLB 0
0902: CALL 00AA
0906: MOVLB 6
0908: BTFSC xFF.7
090A: BSF FF2.7
090C: SUBLW FF
090E: BNZ 0914
0910: MOVLW 00
0912: BRA 0916
0914: MOVLW 01
0916: MOVWF 01
0918: BRA 0940
.................... }
.................... else { //OUT
091A: BRA 0940
.................... return(usb_ep_rx_type[endpoint] != USB_ENABLE_DISABLED);
091C: CLRF 03
091E: MOVF xFD,W
0920: MOVFF FF2,6FF
0924: BCF FF2.7
0926: MOVLB 0
0928: CALL 00CA
092C: MOVLB 6
092E: BTFSC xFF.7
0930: BSF FF2.7
0932: SUBLW FF
0934: BNZ 093A
0936: MOVLW 00
0938: BRA 093C
093A: MOVLW 01
093C: MOVWF 01
093E: BRA 0940
.................... }
.................... }
0940: MOVLB 0
0942: GOTO 0AA8 (RETURN)
....................
.................... // see usb.h for documentation
.................... void usb_isr_tok_in_dne(int8 endpoint) {
.................... if (endpoint==0) {
*
1058: MOVLB 6
105A: MOVF xFD,F
105C: BNZ 107A
.................... if (USB_stack_status.dev_req == GET_DESCRIPTOR) {usb_copy_desc_seg_to_ep();} //check this, we are missing report descriptor?
105E: DECFSZ 1D,W
1060: BRA 106C
1062: MOVLB 0
1064: CALL 03FA
.................... else if (USB_stack_status.dev_req == SET_ADDRESS) {usb_finish_set_address();}
1068: BRA 1076
106A: MOVLB 6
106C: MOVF 1D,W
106E: SUBLW 02
1070: BNZ 1078
1072: MOVLB 0
1074: BRA 0F7A
1076: MOVLB 6
.................... }
.................... #if USB_CDC_DEVICE
.................... else if (endpoint==USB_CDC_DATA_IN_ENDPOINT) { //see ex_usb_serial.c example and usb_cdc.h driver
1078: BRA 1086
107A: MOVF xFD,W
107C: SUBLW 02
107E: BNZ 1086
.................... usb_isr_tok_in_cdc_data_dne();
1080: MOVLB 0
1082: BRA 104E
1084: MOVLB 6
.................... }
.................... #endif
.................... }
1086: MOVLB 0
1088: RETLW 00
....................
.................... // see usb.h for documentation
.................... void usb_isr_tok_out_dne(int8 endpoint)
.................... {
.................... //TODO:
.................... if (endpoint==0) {
*
0F42: MOVLB 6
0F44: MOVF xFD,F
0F46: BNZ 0F50
.................... debug_usb(debug_putc,"TOUT 0 ");
.................... #if USB_CDC_DEVICE
.................... usb_isr_tok_out_cdc_control_dne();
0F48: MOVLB 0
0F4A: BRA 0E7E
.................... #else
.................... usb_init_ep0_setup();
.................... #endif
.................... }
.................... #if USB_CDC_DEVICE
.................... else if (endpoint==USB_CDC_DATA_OUT_ENDPOINT) { //see ex_usb_serial.c example and usb_cdc.h driver
0F4C: BRA 0F5A
0F4E: MOVLB 6
0F50: MOVF xFD,W
0F52: SUBLW 02
0F54: BNZ 0F5C
.................... usb_isr_tok_out_cdc_data_dne();
0F56: MOVLB 0
0F58: BRA 0F2C
0F5A: MOVLB 6
.................... }
.................... #endif
.................... //else {
.................... // bit_set(__usb_kbhit_status,endpoint);
.................... //}
.................... }
0F5C: MOVLB 0
0F5E: RETLW 00
....................
....................
.................... //---- process setup message stage -----------//
....................
.................... // see usb.h for documentation
.................... void usb_isr_tok_setup_dne(void)
.................... {
.................... USB_stack_status.dev_req=NONE; // clear the device request..
*
0BC0: CLRF 1D
....................
.................... switch(usb_ep0_rx_buffer[0] & 0x7F) {
0BC2: MOVLB 4
0BC4: MOVF x18,W
0BC6: ANDLW 7F
0BC8: MOVLB 0
0BCA: BZ 0BDA
0BCC: XORLW 01
0BCE: BZ 0BDC
0BD0: XORLW 03
0BD2: BZ 0BDE
0BD4: XORLW 23
0BD6: BZ 0BE0
0BD8: BRA 0BE2
....................
.................... case 0x00: //standard to device
.................... debug_usb(debug_putc," d");
.................... usb_isr_tkn_setup_StandardDevice();
0BDA: BRA 078C
.................... break;
....................
.................... case 0x01: //standard to interface
.................... debug_usb(debug_putc," i");
.................... usb_isr_tkn_setup_StandardInterface();
0BDC: BRA 0840
.................... break;
....................
.................... case 0x02: //standard to endpoint
.................... debug_usb(debug_putc," e");
.................... usb_isr_tkn_setup_StandardEndpoint();
0BDE: BRA 0AA2
.................... break;
....................
.................... #IF USB_HID_DEVICE
.................... case 0x21: //class specific request. the only class this driver supports is HID
.................... debug_usb(debug_putc," hid");
.................... usb_isr_tkn_setup_ClassInterface();
.................... break;
.................... #endif
....................
.................... #if USB_CDC_DEVICE
.................... case 0x21:
.................... debug_usb(debug_putc," cdc");
.................... usb_isr_tkn_cdc();
0BE0: BRA 0B12
.................... break;
.................... #endif
.................... //TODO: IF YOU WANT VENDOR SPECIFC REQUEST SUPPORT YOU MUST ADD IT HERE
....................
.................... default:
.................... usb_request_stall();
0BE2: RCALL 03F4
.................... break;
0BE4: BRA 0BE6
.................... }
.................... }
0BE6: GOTO 10C2 (RETURN)
....................
.................... /**************************************************************
.................... /* usb_isr_tkn_setup_StandardDevice()
.................... /*
.................... /* Input: usb_ep0_rx_buffer[1] == bRequest
.................... /*
.................... /* Summary: bmRequestType told us it was a Standard Device request.
.................... /* bRequest says which request. Only certain requests are valid,
.................... /* if a non-valid request was made then return with an Wrong-Statue (IDLE)
.................... /*
.................... /* Part of usb_isr_tok_setup_dne()
.................... /***************************************************************/
.................... void usb_isr_tkn_setup_StandardDevice(void) {
.................... switch(usb_ep0_rx_buffer[1]) {
*
078C: MOVLB 4
078E: MOVF x19,W
0790: MOVLB 0
0792: BZ 07AE
0794: XORLW 01
0796: BZ 07C2
0798: XORLW 02
079A: BZ 07DC
079C: XORLW 06
079E: BZ 07F4
07A0: XORLW 03
07A2: BZ 0806
07A4: XORLW 0E
07A6: BZ 0808
07A8: XORLW 01
07AA: BZ 0818
07AC: BRA 0838
....................
.................... case USB_STANDARD_REQUEST_GET_STATUS: //0
.................... debug_usb(debug_putc,"GS");
.................... usb_ep0_tx_buffer[0]=USB_stack_status.status_device;
07AE: MOVFF 1F,458
.................... usb_ep0_tx_buffer[1]=0;
07B2: MOVLB 4
07B4: CLRF x59
.................... usb_request_send_response(2);
07B6: MOVLW 02
07B8: MOVLB 7
07BA: MOVWF x00
07BC: MOVLB 0
07BE: RCALL 03EE
.................... break;
07C0: BRA 083C
....................
.................... case USB_STANDARD_REQUEST_CLEAR_FEATURE: //1
.................... if (usb_ep0_rx_buffer[2] == 1) {
07C2: MOVLB 4
07C4: DECFSZ x1A,W
07C6: BRA 07D6
.................... debug_usb(debug_putc,"CF");
.................... USB_stack_status.status_device &= 1;
07C8: MOVLW 01
07CA: ANDWF 1F,F
.................... usb_put_0len_0();
07CC: MOVLB 7
07CE: CLRF x00
07D0: MOVLB 0
07D2: RCALL 03EE
.................... }
.................... else
07D4: BRA 07DA
.................... usb_request_stall();
07D6: MOVLB 0
07D8: RCALL 03F4
.................... break;
07DA: BRA 083C
....................
.................... case USB_STANDARD_REQUEST_SET_FEATURE: //3
.................... if (usb_ep0_rx_buffer[2] == 1) {
07DC: MOVLB 4
07DE: DECFSZ x1A,W
07E0: BRA 07EE
.................... debug_usb(debug_putc,"SF");
.................... USB_stack_status.status_device |= 2;
07E2: BSF 1F.1
.................... usb_put_0len_0();
07E4: MOVLB 7
07E6: CLRF x00
07E8: MOVLB 0
07EA: RCALL 03EE
.................... }
.................... else
07EC: BRA 07F2
.................... usb_request_stall();
07EE: MOVLB 0
07F0: RCALL 03F4
.................... break;
07F2: BRA 083C
....................
.................... case USB_STANDARD_REQUEST_SET_ADDRESS: //5
.................... debug_usb(debug_putc,"SA");
.................... USB_stack_status.dev_req=SET_ADDRESS; //currently processing set_address request
07F4: MOVLW 02
07F6: MOVWF 1D
.................... USB_address_pending=usb_ep0_rx_buffer[2];
07F8: MOVFF 41A,26
.................... #ifdef __USBN__ //NATIONAL part handles this differently than pic16c7x5
.................... USB_stack_status.dev_req=NONE; //currently processing set_address request
.................... usb_set_address(USB_address_pending);
.................... USB_stack_status.curr_config=0; // make sure current configuration is 0
.................... #endif
.................... usb_put_0len_0();
07FC: MOVLB 7
07FE: CLRF x00
0800: MOVLB 0
0802: RCALL 03EE
.................... break;
0804: BRA 083C
....................
.................... case USB_STANDARD_REQUEST_GET_DESCRIPTOR: //6
.................... debug_usb(debug_putc,"GD");
.................... usb_Get_Descriptor();
0806: BRA 049C
.................... break;
....................
.................... case USB_STANDARD_REQUEST_GET_CONFIGURATION: //8
.................... debug_usb(debug_putc,"GC");
.................... usb_ep0_tx_buffer[0]=USB_stack_status.curr_config;
0808: MOVFF 1E,458
.................... usb_request_send_response(1);
080C: MOVLW 01
080E: MOVLB 7
0810: MOVWF x00
0812: MOVLB 0
0814: RCALL 03EE
.................... break;
0816: BRA 083C
....................
.................... case USB_STANDARD_REQUEST_SET_CONFIGURATION: //9
.................... if (usb_ep0_rx_buffer[2] <= USB_NUM_CONFIGURATIONS) {
0818: MOVLB 4
081A: MOVF x1A,W
081C: SUBLW 01
081E: BNC 0834
.................... USB_stack_status.curr_config=usb_ep0_rx_buffer[2];
0820: MOVFF 41A,1E
.................... usb_set_configured(usb_ep0_rx_buffer[2]);
0824: MOVFF 41A,6FD
0828: MOVLB 0
082A: BRA 055C
.................... debug_usb(debug_putc,"SC%U", USB_stack_status.curr_config);
.................... usb_put_0len_0();
082C: MOVLB 7
082E: CLRF x00
0830: MOVLB 0
0832: RCALL 03EE
.................... }
.................... break;
0834: MOVLB 0
0836: BRA 083C
....................
.................... default:
.................... usb_request_stall();
0838: RCALL 03F4
.................... break;
083A: BRA 083C
.................... }
.................... }
083C: GOTO 0BE6 (RETURN)
....................
.................... /**************************************************************
.................... /* usb_isr_tkn_setup_StandardInterface()
.................... /*
.................... /* Input: usb_ep0_rx_buffer[1] == bRequest
.................... /*
.................... /* Summary: bmRequestType told us it was a Standard Interface request.
.................... /* bRequest says which request. Only certain requests are valid,
.................... /* if a non-valid request was made then return with an Wrong-Statue (IDLE)
.................... /*
.................... /* Part of usb_isr_tok_setup_dne()
.................... /***************************************************************/
.................... void usb_isr_tkn_setup_StandardInterface(void) {
.................... int8 curr_config;
....................
.................... curr_config=USB_stack_status.curr_config;
0840: MOVFF 1E,6FD
....................
.................... switch (usb_ep0_rx_buffer[1]) {
0844: MOVLB 4
0846: MOVF x19,W
0848: MOVLB 0
084A: BZ 0856
084C: XORLW 0A
084E: BZ 0868
0850: XORLW 01
0852: BZ 08B6
0854: BRA 08E0
.................... case USB_STANDARD_REQUEST_GET_STATUS:
.................... debug_usb(debug_putc,"GS");
.................... usb_ep0_tx_buffer[0]=0;
0856: MOVLB 4
0858: CLRF x58
.................... usb_ep0_tx_buffer[1]=0;
085A: CLRF x59
.................... usb_request_send_response(2);
085C: MOVLW 02
085E: MOVLB 7
0860: MOVWF x00
0862: MOVLB 0
0864: RCALL 03EE
.................... break;
0866: BRA 08E4
....................
.................... case USB_STANDARD_REQUEST_GET_INTERFACE:
.................... if ( curr_config && (usb_ep0_rx_buffer[4] < USB_NUM_INTERFACES[curr_config-1]) ) { //book says only supports configed state
0868: MOVLB 6
086A: MOVF xFD,F
086C: BZ 08B0
086E: MOVLW 01
0870: SUBWF xFD,W
0872: CLRF 03
0874: MOVFF FF2,6FE
0878: BCF FF2.7
087A: MOVLB 0
087C: RCALL 019E
087E: MOVLB 6
0880: BTFSC xFE.7
0882: BSF FF2.7
0884: MOVWF 01
0886: MOVLB 4
0888: SUBWF x1C,W
088A: BTFSS FD8.0
088C: BRA 0892
088E: MOVLB 6
0890: BRA 08B0
.................... debug_usb(debug_putc,"GI");
.................... usb_ep0_tx_buffer[0]=USB_Interface[usb_ep0_rx_buffer[4]];//our new outgoing byte
0892: CLRF 03
0894: MOVF x1C,W
0896: ADDLW 29
0898: MOVWF FE9
089A: MOVLW 00
089C: ADDWFC 03,W
089E: MOVWF FEA
08A0: MOVFF FEF,458
.................... usb_request_send_response(1);; //send byte back
08A4: MOVLW 01
08A6: MOVLB 7
08A8: MOVWF x00
08AA: MOVLB 0
08AC: RCALL 03EE
.................... }
.................... else
08AE: BRA 08B4
.................... usb_request_stall();
08B0: MOVLB 0
08B2: RCALL 03F4
.................... break;
08B4: BRA 08E4
....................
.................... case USB_STANDARD_REQUEST_SET_INTERFACE:
.................... if (curr_config) { //if configured state
08B6: MOVLB 6
08B8: MOVF xFD,F
08BA: BZ 08DA
.................... debug_usb(debug_putc,"SI");
.................... USB_Interface[usb_ep0_rx_buffer[4]]=usb_ep0_rx_buffer[2];
08BC: CLRF 03
08BE: MOVLB 4
08C0: MOVF x1C,W
08C2: ADDLW 29
08C4: MOVWF FE9
08C6: MOVLW 00
08C8: ADDWFC 03,W
08CA: MOVWF FEA
08CC: MOVFF 41A,FEF
.................... usb_put_0len_0();
08D0: MOVLB 7
08D2: CLRF x00
08D4: MOVLB 0
08D6: RCALL 03EE
.................... }
.................... else
08D8: BRA 08DE
.................... usb_request_stall();
08DA: MOVLB 0
08DC: RCALL 03F4
.................... break;
08DE: BRA 08E4
....................
.................... #IF USB_HID_DEVICE
.................... case USB_STANDARD_REQUEST_GET_DESCRIPTOR:
.................... debug_usb(debug_putc,"GD");
.................... usb_Get_Descriptor();
.................... break;
.................... #endif
....................
.................... // case USB_STANDARD_REQUEST_CLEAR_FEATURE:
.................... // case USB_STANDARD_REQUEST_SET_FEATURE:
.................... // let default take care of these, goto wrongstate
.................... default:
.................... usb_request_stall();
08E0: RCALL 03F4
.................... break;
08E2: BRA 08E4
.................... }
.................... }
08E4: GOTO 0BE6 (RETURN)
....................
.................... /**************************************************************
.................... /* usb_isr_tkn_setup_StandardEndpoint()
.................... /*
.................... /* Input: usb_ep0_rx_buffer[1] == bRequest
.................... /*
.................... /* Summary: bmRequestType told us it was a Standard Endpoint request.
.................... /* bRequest says which request. Only certain requests are valid,
.................... /* if a non-valid request was made then return with an Wrong-Statue (IDLE)
.................... /*
.................... /* Part of usb_isr_tok_setup_dne()
.................... /***************************************************************/
.................... void usb_isr_tkn_setup_StandardEndpoint(void) {
.................... if (usb_endpoint_is_valid(usb_ep0_rx_buffer[4])) {
*
0AA2: MOVFF 41C,6FD
0AA6: BRA 08E8
0AA8: MOVF 01,F
0AAA: BZ 0B08
.................... switch(usb_ep0_rx_buffer[1]) {
0AAC: MOVLB 4
0AAE: MOVF x19,W
0AB0: XORLW 01
0AB2: MOVLB 0
0AB4: BZ 0AC0
0AB6: XORLW 02
0AB8: BZ 0AD0
0ABA: XORLW 03
0ABC: BZ 0AE0
0ABE: BRA 0B04
....................
.................... case USB_STANDARD_REQUEST_CLEAR_FEATURE:
.................... debug_usb(debug_putc,"CF");
.................... usb_unstall_ep(usb_ep0_rx_buffer[4]);
0AC0: MOVFF 41C,6FD
0AC4: BRA 0946
.................... usb_put_0len_0();
0AC6: MOVLB 7
0AC8: CLRF x00
0ACA: MOVLB 0
0ACC: RCALL 03EE
.................... break;
0ACE: BRA 0B08
....................
.................... case USB_STANDARD_REQUEST_SET_FEATURE:
.................... debug_usb(debug_putc,"SF");
.................... usb_stall_ep(usb_ep0_rx_buffer[4]);
0AD0: MOVFF 41C,6FD
0AD4: BRA 09B4
.................... usb_put_0len_0();
0AD6: MOVLB 7
0AD8: CLRF x00
0ADA: MOVLB 0
0ADC: RCALL 03EE
.................... break;
0ADE: BRA 0B08
....................
.................... case USB_STANDARD_REQUEST_GET_STATUS:
.................... debug_usb(debug_putc,"GS");
.................... usb_ep0_tx_buffer[0]=0;
0AE0: MOVLB 4
0AE2: CLRF x58
.................... usb_ep0_tx_buffer[1]=0;
0AE4: CLRF x59
.................... if (usb_endpoint_stalled(usb_ep0_rx_buffer[4])) {
0AE6: MOVFF 41C,6FD
0AEA: MOVLB 0
0AEC: BRA 0A24
0AEE: MOVF 01,F
0AF0: BZ 0AF8
.................... usb_ep0_tx_buffer[0]=1;
0AF2: MOVLW 01
0AF4: MOVLB 4
0AF6: MOVWF x58
.................... }
.................... usb_request_send_response(2);
0AF8: MOVLW 02
0AFA: MOVLB 7
0AFC: MOVWF x00
0AFE: MOVLB 0
0B00: RCALL 03EE
.................... break;
0B02: BRA 0B08
....................
.................... default:
.................... usb_request_stall();
0B04: RCALL 03F4
.................... break;
0B06: BRA 0B08
.................... }
.................... }
.................... }
0B08: GOTO 0BE6 (RETURN)
....................
.................... /**************************************************************
.................... /* usb_isr_tkn_setup_ClassInterface()
.................... /*
.................... /* Input: usb_ep0_rx_buffer[1] == bRequest
.................... /*
.................... /* Summary: bmRequestType told us it was a Class request. The only Class this drivers supports is HID.
.................... /* bRequest says which request. Only certain requests are valid,
.................... /* if a non-valid request was made then return with an Wrong-Statue (IDLE)
.................... /*
.................... /* Part of usb_isr_tok_setup_dne()
.................... /* Only compiled if HID_DEVICE is TRUE
.................... /***************************************************************/
.................... #IF USB_HID_DEVICE
.................... void usb_isr_tkn_setup_ClassInterface(void) {
.................... switch(usb_ep0_rx_buffer[1]) {
....................
.................... #IF USB_HID_BOOT_PROTOCOL
.................... case USB_HID_REQUEST_GET_PROTOCOL: //03
.................... debug_usb(debug_putc,"GP");
.................... usb_ep0_tx_buffer[0]=hid_protocol[usb_ep0_rx_buffer[4]];
.................... usb_request_send_response(1);
.................... break;
.................... #ENDIF
....................
.................... #IF USB_HID_BOOT_PROTOCOL
.................... case USB_HID_REQUEST_SET_PROTOCOL: //0b
.................... debug_usb(debug_putc,"SP");
.................... hid_protocol[usb_ep0_rx_buffer[4]]=usb_ep0_rx_buffer[2];
.................... usb_put_0len_0(); //send 0len packet69
.................... break;
.................... #ENDIF
....................
.................... #IF USB_HID_IDLE
.................... case USB_HID_REQUEST_SET_IDLE: //0a
.................... #error TODO: if you want to support SET_IDLE, add code here
.................... #ENDIF
....................
.................... #IF USB_HID_IDLE
.................... case USB_HID_REQUEST_GET_IDLE: //02
.................... #error TODO: if you want to support GET_IDLE, add code here
.................... #ENDIF
....................
.................... default:
.................... usb_request_stall();
.................... break;
.................... }
.................... }
.................... #ENDIF
....................
.................... /**************************************************************
.................... /* usb_Get_Descriptor()
.................... /*
.................... /* Input: usb_ep0_rx_buffer[3] == wValue, which descriptor we want
.................... /* usb_ep0_rx_buffer[6,7] == Max length the host will accept
.................... /*
.................... /* Summary: Checks to see if we want a standard descriptor (Interface, Endpoint, Config, Device, String, etc.),
.................... /* or a class specific (HID) descriptor. Since some pics (especially the PIC167x5) doesn't have
.................... /* pointers to constants we must simulate or own by setting up global registers that say
.................... /* which constant array to deal with, which position to start in this array, and the length.
.................... /* Once these globals are setup the first packet is sent. If a descriptor takes more than one packet
.................... /* the PC will send an IN request to endpoint 0, and this will be handled by usb_isr_tok_in_dne()
.................... /* which will send the rest of the data.
.................... /*
.................... /* Part of usb_isr_tok_setup_dne()
.................... /***************************************************************/
.................... void usb_Get_Descriptor() {
.................... usb_getdesc_ptr=0;
*
049C: CLRF 27
.................... USB_stack_status.getdesc_type=USB_GETDESC_CONFIG_TYPE;
049E: CLRF 20
....................
.................... switch(usb_ep0_rx_buffer[3]) {
04A0: MOVLB 4
04A2: MOVF x1B,W
04A4: XORLW 01
04A6: MOVLB 0
04A8: BZ 04B8
04AA: XORLW 03
04AC: BZ 04C2
04AE: XORLW 01
04B0: BZ 04C8
04B2: XORLW 22
04B4: BZ 04FA
04B6: BRA 053C
.................... case USB_DESC_DEVICE_TYPE: //1
.................... usb_getdesc_len=USB_DESC_DEVICE_LEN;
04B8: MOVLW 12
04BA: MOVWF 28
.................... USB_stack_status.getdesc_type=USB_GETDESC_DEVICE_TYPE;
04BC: MOVLW 03
04BE: MOVWF 20
.................... break;
04C0: BRA 0540
....................
.................... //windows hosts will send a FF max len and expect you to send all configs without asking for them individually.
.................... case USB_DESC_CONFIG_TYPE: //2
.................... usb_getdesc_len=USB_TOTAL_CONFIG_LEN;
04C2: MOVLW 43
04C4: MOVWF 28
.................... break;
04C6: BRA 0540
....................
.................... case USB_DESC_STRING_TYPE: //3
.................... USB_stack_status.getdesc_type=USB_GETDESC_STRING_TYPE;
04C8: MOVLW 02
04CA: MOVWF 20
.................... usb_getdesc_ptr=USB_STRING_DESC_OFFSET[usb_ep0_rx_buffer[2]];
04CC: CLRF 03
04CE: MOVLB 4
04D0: MOVF x1A,W
04D2: ADDLW 21
04D4: MOVWF FE9
04D6: MOVLW 00
04D8: ADDWFC 03,W
04DA: MOVWF FEA
04DC: MOVFF FEF,27
.................... usb_getdesc_len=USB_STRING_DESC[usb_getdesc_ptr];
04E0: CLRF 03
04E2: MOVF 27,W
04E4: MOVFF FF2,6FD
04E8: BCF FF2.7
04EA: MOVLB 0
04EC: RCALL 01EA
04EE: MOVLB 6
04F0: BTFSC xFD.7
04F2: BSF FF2.7
04F4: MOVWF 28
.................... break;
04F6: MOVLB 0
04F8: BRA 0540
....................
.................... #IF USB_HID_DEVICE || USB_CDC_DEVICE
.................... case USB_DESC_CLASS_TYPE: //0x21
.................... //TODO does this work for multiple interfaces or multiple languages?
.................... //usb_getdesc_ptr=USB_CLASS_DESCRIPTORS[0][usb_ep0_rx_buffer[4]][usb_ep0_rx_buffer[2]];
.................... usb_getdesc_ptr=USB_CLASS_DESCRIPTORS[0][0][usb_ep0_rx_buffer[2]];
04FA: CLRF 03
04FC: MOVLB 4
04FE: MOVF x1A,W
0500: MOVFF FF2,6FD
0504: BCF FF2.7
0506: MOVLB 0
0508: RCALL 01B0
050A: MOVLB 6
050C: BTFSC xFD.7
050E: BSF FF2.7
0510: MOVWF 27
.................... if (usb_getdesc_ptr!=0xFF) {
0512: INCFSZ 27,W
0514: BRA 0518
0516: BRA 0536
.................... usb_getdesc_len=USB_CONFIG_DESC[usb_getdesc_ptr];
0518: CLRF 03
051A: MOVF 27,W
051C: MOVFF FF2,6FD
0520: BCF FF2.7
0522: MOVLB 0
0524: RCALL 014A
0526: MOVLB 6
0528: BTFSC xFD.7
052A: BSF FF2.7
052C: MOVWF 28
.................... break;
052E: MOVLB 0
0530: BRA 0540
.................... }
.................... else {
0532: BRA 053C
0534: MOVLB 6
.................... usb_request_stall();
0536: MOVLB 0
0538: RCALL 03F4
.................... return;
053A: BRA 0558
.................... }
.................... #endif
....................
.................... #IF USB_HID_DEVICE
.................... case USB_DESC_HIDREPORT_TYPE: //0x22
.................... usb_getdesc_ptr=USB_CLASS_SPECIFIC_DESC_LOOKUP[0][usb_ep0_rx_buffer[4]];
.................... if (usb_getdesc_ptr !=0xFF) {
.................... USB_stack_status.getdesc_type=USB_GETDESC_HIDREPORT_TYPE;
.................... usb_getdesc_len=USB_CLASS_SPECIFIC_DESC_LOOKUP_SIZE[0][usb_ep0_rx_buffer[4]];
.................... break;
.................... }
.................... else {
.................... usb_request_stall();
.................... return;
.................... }
.................... #endif
....................
.................... default:
.................... usb_request_stall();
053C: RCALL 03F4
.................... return;
053E: BRA 0558
.................... }
.................... if (usb_ep0_rx_buffer[7]==0) {
0540: MOVLB 4
0542: MOVF x1F,F
0544: BNZ 0550
.................... if (usb_getdesc_len > usb_ep0_rx_buffer[6])
0546: MOVF 28,W
0548: SUBWF x1E,W
054A: BC 0550
.................... usb_getdesc_len = usb_ep0_rx_buffer[6];
054C: MOVFF 41E,28
.................... }
.................... USB_stack_status.dev_req=GET_DESCRIPTOR;
0550: MOVLW 01
0552: MOVWF 1D
.................... usb_copy_desc_seg_to_ep();
0554: MOVLB 0
0556: RCALL 03FA
.................... }
0558: GOTO 083C (RETURN)
....................
.................... /**************************************************************
.................... /* usb_finish_set_address()
.................... /*
.................... /* Input: USB_address_pending holds the address we were asked to set to.
.................... /*
.................... /* Summary: Sets the address.
.................... /*
.................... /* This code should only be run on the PIC USB peripheral, and not the
.................... /* National peripheral.
.................... /*
.................... /* Part of usb_isr_tok_setup_dne()
.................... /***************************************************************/
.................... void usb_finish_set_address() {
.................... debug_usb(debug_putc," FSA ");
.................... USB_stack_status.curr_config=0; // make sure current configuration is 0
*
0F7A: CLRF 1E
....................
.................... #ifdef __PIC__
.................... USB_stack_status.dev_req=NONE; // no request pending
0F7C: CLRF 1D
.................... usb_set_address(USB_address_pending);
0F7E: MOVFF 26,6FE
0F82: BRA 0F60
.................... #endif
.................... }
0F84: GOTO 1076 (RETURN)
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... ///
.................... /// The following function retrieve data from constant arrays. This may
.................... /// look un-optimized, but remember that you can't create a pointer to
.................... /// a constant array.
.................... ///
.................... ///////////////////////////////////////////////////////////////////////////
.................... void usb_copy_desc_seg_to_ep(void) {
.................... unsigned int i=0;
*
03FA: MOVLB 6
03FC: CLRF xFE
.................... char c;
....................
.................... while ((usb_getdesc_len)&&(i<USB_MAX_EP0_PACKET_LENGTH))
.................... {
03FE: MOVF 28,F
0400: BZ 0486
0402: MOVF xFE,W
0404: SUBLW 3F
0406: BNC 0486
.................... switch(USB_stack_status.getdesc_type) {
0408: MOVF 20,W
040A: MOVLB 0
040C: BZ 0418
040E: XORLW 02
0410: BZ 0432
0412: XORLW 01
0414: BZ 044C
0416: BRA 0466
.................... case USB_GETDESC_CONFIG_TYPE:
.................... c=USB_CONFIG_DESC[usb_getdesc_ptr];
0418: CLRF 03
041A: MOVF 27,W
041C: MOVFF FF2,700
0420: BCF FF2.7
0422: RCALL 014A
0424: MOVLB 7
0426: BTFSC x00.7
0428: BSF FF2.7
042A: MOVFF FE8,6FF
.................... break;
042E: MOVLB 0
0430: BRA 0466
....................
.................... #IF USB_HID_DEVICE
.................... case USB_GETDESC_HIDREPORT_TYPE:
.................... c=USB_CLASS_SPECIFIC_DESC[usb_getdesc_ptr];
.................... break;
.................... #endif
....................
.................... case USB_GETDESC_STRING_TYPE:
.................... c=USB_STRING_DESC[usb_getdesc_ptr];
0432: CLRF 03
0434: MOVF 27,W
0436: MOVFF FF2,700
043A: BCF FF2.7
043C: RCALL 01EA
043E: MOVLB 7
0440: BTFSC x00.7
0442: BSF FF2.7
0444: MOVFF FE8,6FF
.................... break;
0448: MOVLB 0
044A: BRA 0466
....................
.................... case USB_GETDESC_DEVICE_TYPE:
.................... c=USB_DEVICE_DESC[usb_getdesc_ptr];
044C: CLRF 03
044E: MOVF 27,W
0450: MOVFF FF2,700
0454: BCF FF2.7
0456: RCALL 01C8
0458: MOVLB 7
045A: BTFSC x00.7
045C: BSF FF2.7
045E: MOVFF FE8,6FF
.................... break;
0462: MOVLB 0
0464: BRA 0466
.................... }
.................... usb_getdesc_ptr++;
0466: INCF 27,F
.................... usb_getdesc_len--;
0468: DECF 28,F
.................... usb_ep0_tx_buffer[i++]=c;
046A: MOVLB 6
046C: MOVF xFE,W
046E: INCF xFE,F
0470: ADDLW 58
0472: CLRF 03
0474: BTFSC FD8.0
0476: INCF 03,F
0478: MOVWF FE9
047A: MOVLW 04
047C: ADDWF 03,W
047E: MOVWF FEA
0480: MOVFF 6FF,FEF
.................... }
0484: BRA 03FE
....................
.................... if ((!usb_getdesc_len)&&(i!=USB_MAX_EP0_PACKET_LENGTH)) {
0486: MOVF 28,F
0488: BNZ 0492
048A: MOVF xFE,W
048C: SUBLW 40
048E: BZ 0492
.................... USB_stack_status.dev_req = NONE;
0490: CLRF 1D
.................... }
....................
.................... usb_request_send_response(i);
0492: MOVFF 6FE,700
0496: MOVLB 0
0498: RCALL 03EE
.................... }
049A: RETLW 00
....................
.................... #ENDIF
....................
....................
.................... struct {
.................... unsigned int32 dwDTERrate; //data terminal rate, in bits per second
.................... unsigned int8 bCharFormat; //num of stop bits (0=1, 1=1.5, 2=2)
.................... unsigned int8 bParityType; //parity (0=none, 1=odd, 2=even, 3=mark, 4=space)
.................... unsigned int8 bDataBits; //data bits (5,6,7,8 or 16)
.................... } __attribute__((__packed__)) usb_cdc_line_coding;
....................
.................... //length of time, in ms, of break signal as we received in a SendBreak message.
.................... //if ==0xFFFF, send break signal until we receive a 0x0000.
.................... unsigned int16 usb_cdc_break;
....................
.................... unsigned int8 usb_cdc_encapsulated_cmd[8];
....................
.................... unsigned int8 usb_cdc_put_buffer[USB_CDC_DATA_IN_SIZE];
.................... #define usb_cdc_put_buffer_free() usb_tbe(USB_CDC_DATA_IN_ENDPOINT)
.................... #if USB_CDC_DATA_IN_SIZE>=0x100
.................... unsigned int16 usb_cdc_put_buffer_nextin=0;
.................... // int16 usb_cdc_last_data_packet_size;
.................... #else
.................... unsigned int8 usb_cdc_put_buffer_nextin=0;
.................... // int8 usb_cdc_last_data_packet_size;
.................... #endif
....................
.................... struct {
.................... int1 got;
.................... #if USB_CDC_DATA_OUT_SIZE>=0x100
.................... unsigned int16 len;
.................... unsigned int16 index;
.................... #else
.................... unsigned int8 len;
.................... unsigned int8 index;
.................... #endif
.................... } usb_cdc_get_buffer_status;
....................
.................... #if defined(__PIC__)
.................... #define usb_cdc_get_buffer_status_buffer usb_ep2_rx_buffer
.................... #else
.................... unsigned int8 usb_cdc_get_buffer_status_buffer[USB_CDC_DATA_OUT_SIZE];
.................... #endif
....................
.................... int1 usb_cdc_got_set_line_coding;
....................
.................... struct {
.................... int1 dte_present; //1=DTE present, 0=DTE not present
.................... int1 active; //1=activate carrier, 0=deactivate carrier
.................... unsigned int reserved:6;
.................... } usb_cdc_carrier;
....................
.................... unsigned int8 g_LastCDCDataPacketSize;
....................
.................... enum {USB_CDC_OUT_NOTHING=0, USB_CDC_OUT_COMMAND=1, USB_CDC_OUT_LINECODING=2, USB_CDC_WAIT_0LEN=3} __usb_cdc_state=0;
....................
.................... #if defined(__PCH__)
.................... #byte INTCON=0xFF2
.................... #bit INT_GIE=INTCON.7
.................... #else
.................... #word SR=0x42
.................... #endif
....................
.................... //handle OUT token done interrupt on endpoint 0 [read encapsulated cmd and line coding data]
.................... void usb_isr_tok_out_cdc_control_dne(void) {
.................... debug_usb(debug_putc,"CDC %X ",__usb_cdc_state);
....................
.................... switch (__usb_cdc_state) {
*
0E7E: MOVF x83,W
0E80: XORLW 01
0E82: BZ 0E8A
0E84: XORLW 03
0E86: BZ 0EB2
0E88: BRA 0EDA
.................... //printf(putc_tbe,"@%X@\r\n", __usb_cdc_state);
.................... case USB_CDC_OUT_COMMAND:
.................... //usb_get_packet(0, usb_cdc_encapsulated_cmd, 8);
.................... memcpy(usb_cdc_encapsulated_cmd, usb_ep0_rx_buffer,8);
0E8A: CLRF FEA
0E8C: MOVLW 34
0E8E: MOVWF FE9
0E90: MOVLW 04
0E92: MOVWF FE2
0E94: MOVLW 18
0E96: MOVWF FE1
0E98: MOVLW 08
0E9A: MOVWF 01
0E9C: MOVFF FE6,FEE
0EA0: DECFSZ 01,F
0EA2: BRA 0E9C
.................... #if USB_MAX_EP0_PACKET_LENGTH==8
.................... __usb_cdc_state=USB_CDC_WAIT_0LEN;
.................... usb_request_get_data();
.................... #else
.................... usb_put_0len_0();
0EA4: MOVLB 7
0EA6: CLRF x00
0EA8: MOVLB 0
0EAA: CALL 03EE
.................... __usb_cdc_state=0;
0EAE: CLRF x83
.................... #endif
.................... break;
0EB0: BRA 0EE2
....................
.................... #if USB_MAX_EP0_PACKET_LENGTH==8
.................... case USB_CDC_WAIT_0LEN:
.................... usb_put_0len_0();
.................... __usb_cdc_state=0;
.................... break;
.................... #endif
....................
.................... case USB_CDC_OUT_LINECODING:
.................... //usb_get_packet(0, &usb_cdc_line_coding, 7);
.................... //printf(putc_tbe,"\r\n!GSLC FIN!\r\n");
.................... memcpy(&usb_cdc_line_coding, usb_ep0_rx_buffer,7);
0EB2: CLRF FEA
0EB4: MOVLW 2B
0EB6: MOVWF FE9
0EB8: MOVLW 04
0EBA: MOVWF FE2
0EBC: MOVLW 18
0EBE: MOVWF FE1
0EC0: MOVLW 07
0EC2: MOVWF 01
0EC4: MOVFF FE6,FEE
0EC8: DECFSZ 01,F
0ECA: BRA 0EC4
.................... __usb_cdc_state=0;
0ECC: CLRF x83
.................... usb_put_0len_0();
0ECE: MOVLB 7
0ED0: CLRF x00
0ED2: MOVLB 0
0ED4: CALL 03EE
.................... break;
0ED8: BRA 0EE2
....................
.................... default:
.................... __usb_cdc_state=0;
0EDA: CLRF x83
.................... usb_init_ep0_setup();
0EDC: CALL 0284
.................... break;
0EE0: BRA 0EE2
.................... }
.................... }
0EE2: GOTO 0F4C (RETURN)
....................
.................... //handle IN token on 0 (setup packet)
.................... void usb_isr_tkn_cdc(void) {
.................... //make sure the request goes to a CDC interface
.................... if ((usb_ep0_rx_buffer[4] == 1) || (usb_ep0_rx_buffer[4] == 0)) {
*
0B12: MOVLB 4
0B14: DECFSZ x1C,W
0B16: BRA 0B1A
0B18: BRA 0B1E
0B1A: MOVF x1C,F
0B1C: BNZ 0BBA
.................... //printf(putc_tbe,"!%X!\r\n", usb_ep0_rx_buffer[1]);
.................... switch(usb_ep0_rx_buffer[1]) {
0B1E: MOVF x19,W
0B20: MOVLB 0
0B22: BZ 0B3A
0B24: XORLW 01
0B26: BZ 0B42
0B28: XORLW 21
0B2A: BZ 0B64
0B2C: XORLW 01
0B2E: BZ 0B6E
0B30: XORLW 03
0B32: BZ 0B94
0B34: XORLW 01
0B36: BZ 0BA2
0B38: BRA 0BB4
.................... case 0x00: //send_encapsulated_command
.................... __usb_cdc_state=USB_CDC_OUT_COMMAND;
0B3A: MOVLW 01
0B3C: MOVWF x83
.................... usb_request_get_data();
0B3E: RCALL 0B0C
.................... break;
0B40: BRA 0BB8
....................
.................... case 0x01: //get_encapsulated_command
.................... memcpy(usb_ep0_tx_buffer, usb_cdc_encapsulated_cmd, 8);
0B42: MOVLW 04
0B44: MOVWF FEA
0B46: MOVLW 58
0B48: MOVWF FE9
0B4A: CLRF FE2
0B4C: MOVLW 34
0B4E: MOVWF FE1
0B50: MOVLW 08
0B52: MOVWF 01
0B54: MOVFF FE6,FEE
0B58: DECFSZ 01,F
0B5A: BRA 0B54
.................... usb_request_send_response(usb_ep0_rx_buffer[6]); //send wLength bytes
0B5C: MOVFF 41E,700
0B60: RCALL 03EE
.................... break;
0B62: BRA 0BB8
....................
.................... case 0x20: //set_line_coding
.................... debug_usb(debug_putc,"!GSLC!");
.................... __usb_cdc_state=USB_CDC_OUT_LINECODING;
0B64: MOVLW 02
0B66: MOVWF x83
.................... usb_cdc_got_set_line_coding=TRUE;
0B68: BSF x80.0
.................... usb_request_get_data();
0B6A: RCALL 0B0C
.................... break;
0B6C: BRA 0BB8
....................
.................... case 0x21: //get_line_coding
.................... memcpy(usb_ep0_tx_buffer, &usb_cdc_line_coding, sizeof(usb_cdc_line_coding));
0B6E: MOVLW 04
0B70: MOVWF FEA
0B72: MOVLW 58
0B74: MOVWF FE9
0B76: CLRF FE2
0B78: MOVLW 2B
0B7A: MOVWF FE1
0B7C: MOVLW 07
0B7E: MOVWF 01
0B80: MOVFF FE6,FEE
0B84: DECFSZ 01,F
0B86: BRA 0B80
.................... usb_request_send_response(sizeof(usb_cdc_line_coding)); //send wLength bytes
0B88: MOVLW 07
0B8A: MOVLB 7
0B8C: MOVWF x00
0B8E: MOVLB 0
0B90: RCALL 03EE
.................... break;
0B92: BRA 0BB8
....................
.................... case 0x22: //set_control_line_state
.................... usb_cdc_carrier=usb_ep0_rx_buffer[2];
0B94: MOVFF 41A,81
.................... usb_put_0len_0();
0B98: MOVLB 7
0B9A: CLRF x00
0B9C: MOVLB 0
0B9E: RCALL 03EE
.................... break;
0BA0: BRA 0BB8
....................
.................... case 0x23: //send_break
.................... usb_cdc_break=make16(usb_ep0_rx_buffer[2],usb_ep0_rx_buffer[3]);
0BA2: MOVFF 41A,33
0BA6: MOVFF 41B,32
.................... usb_put_0len_0();
0BAA: MOVLB 7
0BAC: CLRF x00
0BAE: MOVLB 0
0BB0: RCALL 03EE
.................... break;
0BB2: BRA 0BB8
....................
.................... default:
.................... usb_request_stall();
0BB4: RCALL 03F4
.................... break;
0BB6: BRA 0BB8
0BB8: MOVLB 4
.................... }
.................... }
.................... }
0BBA: MOVLB 0
0BBC: GOTO 0BE6 (RETURN)
....................
.................... //handle OUT token done interrupt on endpoint 3 [buffer incoming received chars]
.................... void usb_isr_tok_out_cdc_data_dne(void) {
.................... usb_cdc_get_buffer_status.got=TRUE;
*
0F2C: BSF x7D.0
.................... usb_cdc_get_buffer_status.index=0;
0F2E: CLRF x7F
.................... #if (defined(__PIC__) && __PIC__)
.................... usb_cdc_get_buffer_status.len=usb_rx_packet_size(USB_CDC_DATA_OUT_ENDPOINT);
0F30: MOVLW 02
0F32: MOVLB 6
0F34: MOVWF xFE
0F36: MOVLB 0
0F38: BRA 0EE6
0F3A: MOVFF 01,7E
.................... #else
.................... usb_cdc_get_buffer_status.len=usb_get_packet_buffer(
.................... USB_CDC_DATA_OUT_ENDPOINT,&usb_cdc_get_buffer_status_buffer[0],USB_CDC_DATA_OUT_SIZE);
.................... #endif
.................... }
0F3E: GOTO 0F5A (RETURN)
....................
.................... //handle IN token done interrupt on endpoint 2 [transmit buffered characters]
.................... void usb_isr_tok_in_cdc_data_dne(void)
.................... {
.................... //putc('!');
.................... if (usb_cdc_put_buffer_nextin /* || (g_LastCDCDataPacketSize == USB_CDC_DATA_IN_SIZE)*/ )
*
104E: MOVF x7C,F
1050: BZ 1054
.................... {
.................... //printf("FL3 %LU\r\n", (int16)usb_cdc_put_buffer_nextin);
.................... usb_cdc_flush_out_buffer();
1052: RCALL 102C
.................... }
.................... }
1054: GOTO 1084 (RETURN)
....................
.................... void usb_cdc_flush_out_buffer(void)
.................... {
.................... //printf(putc_tbe, "FL %U\r\n", usb_cdc_put_buffer_nextin);
.................... usb_put_packet(USB_CDC_DATA_IN_ENDPOINT,usb_cdc_put_buffer,usb_cdc_put_buffer_nextin,USB_DTS_TOGGLE);
*
102C: MOVLW 02
102E: MOVLB 7
1030: MOVWF x3A
1032: CLRF x3C
1034: MOVLW 3C
1036: MOVWF x3B
1038: CLRF x3E
103A: MOVFF 7C,73D
103E: MOVLW 02
1040: MOVWF x3F
1042: MOVLB 0
1044: RCALL 0F88
.................... g_LastCDCDataPacketSize = usb_cdc_put_buffer_nextin;
1046: MOVFF 7C,82
.................... usb_cdc_put_buffer_nextin=0;
104A: CLRF x7C
.................... }
104C: RETLW 00
....................
.................... void usb_cdc_init(void)
.................... {
.................... usb_cdc_line_coding.dwDTERrate = 9600;
*
035C: CLRF 2E
035E: CLRF 2D
0360: MOVLW 25
0362: MOVWF 2C
0364: MOVLW 80
0366: MOVWF 2B
.................... usb_cdc_line_coding.bCharFormat = 0;
0368: CLRF 2F
.................... usb_cdc_line_coding.bParityType = 0;
036A: CLRF 30
.................... usb_cdc_line_coding.bDataBits = 8;
036C: MOVLW 08
036E: MOVWF 31
.................... (int8)usb_cdc_carrier = 0;
0370: CLRF x81
.................... usb_cdc_got_set_line_coding = FALSE;
0372: BCF x80.0
.................... usb_cdc_break = 0;
0374: CLRF 33
0376: CLRF 32
.................... usb_cdc_put_buffer_nextin = 0;
0378: CLRF x7C
.................... usb_cdc_get_buffer_status.got = 0;
037A: BCF x7D.0
.................... }
037C: RETLW 00
....................
.................... ////////////////// END USB CONTROL HANDLING //////////////////////////////////
....................
.................... ////////////////// BEGIN USB<->RS232 CDC LIBRARY /////////////////////////////
....................
.................... void usb_cdc_get_discard(void)
.................... {
.................... usb_cdc_get_buffer_status.got = FALSE;
.................... usb_flush_out(USB_CDC_DATA_OUT_ENDPOINT, USB_DTS_TOGGLE);
.................... }
....................
.................... char usb_cdc_getc(void)
.................... {
.................... char c;
....................
.................... while (!usb_cdc_kbhit()) {}
....................
.................... c=usb_cdc_get_buffer_status_buffer[usb_cdc_get_buffer_status.index++];
....................
.................... if (usb_cdc_get_buffer_status.index >= usb_cdc_get_buffer_status.len)
.................... {
.................... usb_cdc_get_discard();
.................... }
....................
.................... return(c);
.................... }
....................
.................... void usb_cdc_putc_fast(char c)
.................... {
.................... #if defined(__PCH__)
.................... int1 old_gie;
....................
.................... //disable global interrupts
.................... old_gie = INT_GIE;
*
1376: MOVLB 6
1378: BCF xDD.0
137A: BTFSC FF2.7
137C: BSF xDD.0
.................... INT_GIE = 0;
137E: BCF FF2.7
.................... #else
.................... int16 oldSR;
....................
.................... oldSR = SR;
.................... SR |= 0xE0;
.................... #endif
....................
.................... if (usb_cdc_put_buffer_nextin >= USB_CDC_DATA_IN_SIZE) {
1380: MOVLB 0
1382: MOVF x7C,W
1384: SUBLW 3F
1386: BC 138C
.................... usb_cdc_put_buffer_nextin = USB_CDC_DATA_IN_SIZE-1; //we just overflowed the buffer!
1388: MOVLW 3F
138A: MOVWF x7C
.................... }
.................... usb_cdc_put_buffer[usb_cdc_put_buffer_nextin++] = c;
138C: MOVF x7C,W
138E: INCF x7C,F
1390: CLRF 03
1392: ADDLW 3C
1394: MOVWF FE9
1396: MOVLW 00
1398: ADDWFC 03,W
139A: MOVWF FEA
139C: MOVFF 6DC,FEF
....................
.................... //renable global interrupts
.................... #if defined(__PCH__)
.................... INT_GIE = old_gie;
13A0: BCF FF2.7
13A2: MOVLB 6
13A4: BTFSC xDD.0
13A6: BSF FF2.7
13A8: CLRF 18
13AA: BTFSC FF2.7
13AC: BSF 18.7
13AE: BCF FF2.7
.................... #else
.................... SR = oldSR;
.................... #endif
....................
.................... /*
.................... if (usb_tbe(USB_CDC_DATA_IN_ENDPOINT)) {
.................... if (usb_cdc_put_buffer_nextin)
.................... usb_cdc_flush_out_buffer();
.................... }
.................... */
.................... if (usb_cdc_put_buffer_free()) {
13B0: MOVLW 02
13B2: MOVLB 7
13B4: MOVWF x47
13B6: MOVLB 0
13B8: RCALL 0D06
13BA: BTFSC 18.7
13BC: BSF FF2.7
13BE: MOVF 01,F
13C0: BZ 13D0
13C2: CLRF 18
13C4: BTFSC FF2.7
13C6: BSF 18.7
13C8: BCF FF2.7
.................... //printf("FL2 %LU\r\n", (int16)usb_cdc_put_buffer_nextin);
.................... usb_cdc_flush_out_buffer();
13CA: RCALL 102C
13CC: BTFSC 18.7
13CE: BSF FF2.7
.................... }
.................... //putc('*');
.................... }
13D0: GOTO 140A (RETURN)
....................
.................... void usb_cdc_putc(char c)
.................... {
.................... while (!usb_cdc_putready())
.................... {
13D4: MOVF x7C,W
13D6: SUBLW 3F
13D8: BC 1404
13DA: CLRF 18
13DC: BTFSC FF2.7
13DE: BSF 18.7
13E0: BCF FF2.7
.................... if (usb_cdc_put_buffer_free())
13E2: MOVLW 02
13E4: MOVLB 7
13E6: MOVWF x47
13E8: MOVLB 0
13EA: RCALL 0D06
13EC: BTFSC 18.7
13EE: BSF FF2.7
13F0: MOVF 01,F
13F2: BZ 1402
13F4: CLRF 18
13F6: BTFSC FF2.7
13F8: BSF 18.7
13FA: BCF FF2.7
.................... {
.................... //printf("FL1 %LU\r\n", (int16)usb_cdc_put_buffer_nextin);
.................... usb_cdc_flush_out_buffer();
13FC: RCALL 102C
13FE: BTFSC 18.7
1400: BSF FF2.7
.................... }
.................... //delay_ms(500);
.................... //printf(putc_tbe,"TBE=%U CNT=%U LST=%U\r\n",usb_tbe(USB_CDC_DATA_IN_ENDPOINT), usb_cdc_put_buffer_nextin, usb_cdc_last_data_packet_size);
.................... }
1402: BRA 13D4
.................... //putc('.');
.................... //putc(c);
.................... usb_cdc_putc_fast(c);
1404: MOVFF 6DB,6DC
1408: BRA 1376
.................... }
140A: RETLW 00
....................
.................... #include <ctype.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _CTYPE
.................... #define _CTYPE
....................
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz")
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isdigit(x) isamong(x,"0123456789")
.................... #define isspace(x) ((x)==' ')
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")
.................... #define iscntrl(x) ((x)<' ')
.................... #define isprint(x) ((x)>=' ')
.................... #define isgraph(x) ((x)>' ')
.................... #define ispunct(x) (((x)>' ')&&!isalnum(x))
....................
.................... #endif
....................
....................
....................
.................... BYTE gethex1_usb()
.................... {
.................... char digit;
....................
.................... digit = usb_cdc_getc();
....................
.................... usb_cdc_putc(digit);
....................
.................... if(digit<='9')
.................... return(digit-'0');
.................... else
.................... return((toupper(digit)-'A')+10);
.................... }
....................
.................... BYTE gethex_usb() {
.................... unsigned int8 lo,hi;
....................
.................... hi = gethex1_usb();
.................... lo = gethex1_usb();
.................... if(lo==0xdd)
.................... return(hi);
.................... else
.................... return( hi*16+lo );
.................... }
....................
.................... void get_string_usb(char* s, unsigned int max) {
.................... unsigned int len;
.................... char c;
....................
.................... --max;
.................... len=0;
.................... do {
.................... c=usb_cdc_getc();
.................... if(c==8) { // Backspace
.................... if(len>0) {
.................... len--;
.................... usb_cdc_putc(c);
.................... usb_cdc_putc(' ');
.................... usb_cdc_putc(c);
.................... }
.................... } else if ((c>=' ')&&(c<='~'))
.................... if(len<max) {
.................... s[len++]=c;
.................... usb_cdc_putc(c);
.................... }
.................... } while(c!=13);
.................... s[len]=0;
.................... }
....................
....................
.................... // stdlib.h is required for the ato_ conversions
.................... // in the following functions
.................... #ifdef _STDLIB
....................
.................... signed int get_int_usb() {
.................... char s[7];
.................... signed int i;
....................
.................... get_string_usb(s, 7);
....................
.................... i=atoi(s);
.................... return(i);
.................... }
....................
.................... signed long get_long_usb() {
.................... char s[13];
.................... signed long l;
....................
.................... get_string_usb(s, 13);
.................... l=atol(s);
.................... return(l);
.................... }
....................
.................... float get_float_usb() {
.................... char s[20];
.................... float f;
....................
.................... get_string_usb(s, 20);
.................... f = atof(s);
.................... return(f);
.................... }
....................
.................... #endif
....................
.................... #include <math.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2008 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// History: ////
.................... //// * 9/20/2001 : Improvments are made to sin/cos code. ////
.................... //// The code now is small, much faster, ////
.................... //// and more accurate. ////
.................... //// * 2/21/2007 : Compiler handles & operator differently and does
.................... //// not return generic (int8 *) so type cast is done ////
.................... //// ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef MATH_H
.................... #define MATH_H
....................
.................... #ifdef PI
.................... #undef PI
.................... #endif
.................... #define PI 3.1415926535897932
....................
....................
.................... #define SQRT2 1.4142135623730950
....................
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279};
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718};
....................
.................... ///////////////////////////// Round Functions //////////////////////////////
....................
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n)
.................... {
.................... float32 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float32)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float32)l);
.................... res = 32768.0*(float32)l;
.................... res += (float32)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float32)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
....................
.................... // Overloaded Functions to take care for new Data types in PCD
.................... // Overloaded function CEIL_FLOOR() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n)
.................... {
.................... float48 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float48)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float48)l);
.................... res = 32768.0*(float32)l;
.................... res += (float48)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float48)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
....................
....................
.................... // Overloaded function CEIL_FLOOR() for data type - Float64
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n)
.................... {
.................... float64 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float64)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float64)l);
.................... res = 32768.0*(float64)l;
.................... res += (float64)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float64)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float floor(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : rounds down the number x.
.................... // Date : N/A
.................... //
.................... float32 floor(float32 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
.................... // Following 2 functions are overloaded functions of floor() for PCD
.................... // Overloaded function floor() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 floor(float48 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
....................
.................... // Overloaded function floor() for data type - Float64
.................... float64 floor(float64 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
.................... #endif
....................
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float ceil(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : rounds up the number x.
.................... // Date : N/A
.................... //
.................... float32 ceil(float32 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
.................... // Following 2 functions are overloaded functions of ceil() for PCD
.................... // Overloaded function ceil() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 ceil(float48 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
....................
.................... // Overloaded function ceil() for data type - Float64
.................... float64 ceil(float64 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float fabs(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the absolute value of floating point number x
.................... // Returns : returns the absolute value of x
.................... // Date : N/A
.................... //
.................... #define fabs abs
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float fmod(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the floating point remainder of x/y
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the
.................... // magnitude of y. If y is zero then a domain error occurs.
.................... // Date : N/A
.................... //
....................
.................... float fmod(float32 x,float32 y)
.................... {
.................... float32 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... //Overloaded function for fmod() for PCD
.................... // Overloaded function fmod() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 fmod(float48 x,float48 y)
.................... {
.................... float48 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... // Overloaded function fmod() for data type - Float64
.................... float64 fmod(float64 x,float64 y)
.................... {
.................... float64 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... #endif
.................... //////////////////// Exponential and logarithmic functions ////////////////////
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float exp(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (e^x)
.................... // Date : N/A
.................... //
.................... #define LN2 0.6931471805599453
....................
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093,
.................... 0.0554965651, 0.240227138, 0.693147172};
....................
....................
.................... float32 exp(float32 x)
.................... {
.................... float32 y, res, r;
.................... #if defined(__PCD__)
.................... int8 data1;
.................... #endif
.................... signed int8 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 88.722838)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&res)) = n + 0x7F;
.................... #endif
....................
.................... #if defined(__PCD__) // Takes care of IEEE format for PCD
.................... data1 = n+0x7F;
.................... if(bit_test(data1,0))
.................... bit_set(*(((unsigned int8 *)(&res)+2)),7);
.................... rotate_right(&data1,1);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&res)+3)) = data1;
.................... #endif
....................
.................... y = y/LN2 - (float32)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
....................
.................... //Overloaded function for exp() for PCD
.................... // Overloaded function exp() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 exp(float48 x)
.................... {
.................... float48 y, res, r;
.................... int8 data1;
.................... signed int8 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 88.722838)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
....................
.................... data1 = n+0x7F;
.................... if(bit_test(data1,0))
.................... bit_set(*(((unsigned int8 *)(&res)+4)),7);
.................... rotate_right(&data1,1);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&res)+5)) = data1;
....................
.................... y = y/LN2 - (float48)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
.................... // Overloaded function exp() for data type - Float64
.................... float64 exp(float64 x)
.................... {
.................... float64 y, res, r;
.................... unsigned int16 data1, data2;
.................... unsigned int16 *p;
.................... signed int16 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 709.7827128)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
....................
.................... #if !defined(__PCD__)
.................... *((unsigned int16 *)(&res)) = n + 0x7F;
.................... #endif
.................... p= (((unsigned int16 *)(&res))+3);
.................... data1 = *p;
.................... data2 = *p;
.................... data1 = n + 0x3FF;
.................... data1 = data1 <<4;
.................... if(bit_test(data2,15))
.................... bit_set(data1,15);
.................... data2 = data2 & 0x000F;
.................... data1 ^= data2;
....................
.................... *(((unsigned int16 *)(&res)+3)) = data1;
....................
....................
.................... y = y/LN2 - (float64)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
.................... #ENDIF
....................
....................
.................... /************************************************************/
....................
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189};
.................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943};
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float log(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the the natural log of x
.................... // Date : N/A
.................... //
.................... float32 log(float32 x)
.................... {
.................... float32 y, res, r, y2;
.................... #if defined(__PCD__)
.................... unsigned int8 data1,data2;
.................... #endif
.................... signed int8 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
....................
.................... #if defined(__PCD__) // Takes care of IEEE format
.................... data2 = *(((unsigned int8 *)(&y))+3);
.................... *(((unsigned int8 *)(&y))+3) = 0x3F;
.................... data1 = *(((unsigned int8 *)(&y))+2);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&y))+2) = data1;
.................... if(bit_test(data2,7))
.................... bit_set(*(((unsigned int8 *)(&y))+3),7);
.................... #endif
....................
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl[0]*y2 + pl[1];
.................... res = res*y2 + pl[2];
.................... res = res*y2 + pl[3];
....................
.................... r = ql[0]*y2 + ql[1];
.................... r = r*y2 + ql[2];
.................... r = r*y2 + ql[3];
....................
.................... res = y*res/r;
.................... #if !defined(__PCD__)
.................... n = *((unsigned int8 *)(&x)) - 0x7E;
.................... #endif
.................... #if defined(__PCD__)
.................... data1 = *(((unsigned int8 *)(&x)+3));
.................... rotate_left(&data1,1);
.................... data2 = *(((unsigned int8 *)(&x)+2));
.................... if(bit_test (data2,7))
.................... bit_set(data1,0);
.................... n = data1 - 0x7E;
.................... #endif
....................
.................... if (n<0)
.................... r = -(float32)-n;
.................... else
.................... r = (float32)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
....................
.................... //Overloaded function for log() for PCD
.................... // Overloaded function log() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 log(float48 x)
.................... {
.................... float48 y, res, r, y2;
.................... unsigned int8 data1,data2;
.................... signed int8 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
....................
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
.................... data2 = *(((unsigned int8 *)(&y))+5);
.................... *(((unsigned int8 *)(&y))+5) = 0x3F;
.................... data1 = *(((unsigned int8 *)(&y))+4);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&y))+4) = data1;
....................
.................... if(bit_test(data2,7))
.................... bit_set(*(((unsigned int8 *)(&y))+4),7);
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl[0]*y2 + pl[1];
.................... res = res*y2 + pl[2];
.................... res = res*y2 + pl[3];
....................
.................... r = ql[0]*y2 + ql[1];
.................... r = r*y2 + ql[2];
.................... r = r*y2 + ql[3];
....................
.................... res = y*res/r;
....................
.................... data1 = *(((unsigned int8 *)(&x)+5));
.................... rotate_left(&data1,1);
.................... data2 = *(((unsigned int8 *)(&x)+4));
.................... if(bit_test (data2,7))
.................... bit_set(data1,0);
....................
.................... n = data1 - 0x7E;
....................
.................... if (n<0)
.................... r = -(float48)-n;
.................... else
.................... r = (float48)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function log() for data type - Float48
.................... #if defined(__PCD__)
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189};
.................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943};
.................... #endif
.................... float64 log(float64 x)
.................... {
.................... float64 y, res, r, y2;
.................... unsigned int16 data1,data2;
.................... unsigned int16 *p;
.................... signed int16 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
.................... p= (((unsigned int16 *)(&y))+3);
.................... data1 = *p;
.................... data2 = *p;
.................... data1 = 0x3FE;
.................... data1 = data1 <<4;
.................... if(bit_test (data2,15))
.................... bit_set(data1,15);
.................... data2 = data2 & 0x000F;
.................... data1 ^=data2;
....................
.................... *p = data1;
....................
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl_64[0]*y2 + pl_64[1];
.................... res = res*y2 + pl_64[2];
.................... res = res*y2 + pl_64[3];
....................
.................... r = ql_64[0]*y2 + ql_64[1];
.................... r = r*y2 + ql_64[2];
.................... r = r*y2 + ql_64[3];
....................
.................... res = y*res/r;
....................
.................... p= (((unsigned int16 *)(&x))+3);
.................... data1 = *p;
.................... bit_clear(data1,15);
.................... data1 = data1 >>4;
.................... n = data1 - 0x3FE;
....................
....................
.................... if (n<0)
.................... r = -(float64)-n;
.................... else
.................... r = (float64)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
.................... #endif
....................
....................
.................... #define LN10 2.3025850929940456
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float log10(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the the log base 10 of x
.................... // Date : N/A
.................... //
.................... float32 log10(float32 x)
.................... {
.................... float32 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
....................
.................... //Overloaded functions for log10() for PCD
.................... // Overloaded function log10() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 log10(float48 x)
.................... {
.................... float48 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
....................
.................... // Overloaded function log10() for data type - Float64
.................... float64 log10(float64 x)
.................... {
.................... float64 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
.................... #endif
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float modf(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description :breaks the argument value int integral and fractional parts,
.................... // ach of which have the same sign as the argument. It stores the integral part
.................... // as a float in the object pointed to by the iptr
.................... // Returns : returns the signed fractional part of value.
.................... // Date : N/A
.................... //
....................
.................... float32 modf(float32 value,float32 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... //Overloaded functions for modf() for PCD
.................... // Overloaded function modf() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 modf(float48 value,float48 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... // Overloaded function modf() for data type - Float64
.................... float64 modf(float64 value,float64 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float pwr(float x,float y)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (x^y)
.................... // Date : N/A
.................... //
.................... float32 pwr(float32 x,float32 y)
.................... {
.................... if(x>=0)
.................... return( exp(y*log(x)) );
.................... else
.................... return( -exp(y*log(-x)) );
.................... }
.................... //Overloaded functions for pwr() for PCD
.................... // Overloaded function pwr() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 pwr(float48 x,float48 y)
.................... {
.................... if(x>=0)
.................... return( exp(y*log(x)) );
.................... else
.................... return( -exp(y*log(-x)) );
.................... }
.................... // Overloaded function pwr() for data type - Float64
.................... float64 pwr(float64 x,float64 y)
.................... {
.................... if(x>=0)
.................... return( exp(y*log(x)) );
.................... else
.................... return( -exp(y*log(-x)) );
.................... }
.................... #endif
....................
.................... //////////////////// Power functions ////////////////////
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float pow(float x,float y)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (x^y)
.................... // Date : N/A
.................... //
.................... float32 pow(float32 x,float32 y)
.................... {
.................... if(x>=0)
.................... return( exp(y*log(x)) );
.................... else
.................... return( -exp(y*log(-x)) );
.................... }
.................... //Overloaded functions for pow() for PCD
.................... // Overloaded function for pow() data type - Float48
.................... #if defined(__PCD__)
.................... float48 pow(float48 x,float48 y)
.................... {
.................... if(x>=0)
.................... return( exp(y*log(x)) );
.................... else
.................... return( -exp(y*log(-x)) );
.................... }
....................
.................... // Overloaded function pow() for data type - Float64
.................... float64 pow(float64 x,float64 y)
.................... {
.................... if(x>=0)
.................... return( exp(y*log(x)) );
.................... else
.................... return( -exp(y*log(-x)) );
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float sqrt(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the square root of x
.................... // Date : N/A
.................... //
.................... float32 sqrt(float32 x)
.................... {
.................... float32 y, res;
.................... #if defined(__PCD__)
.................... unsigned int16 data1,data2;
.................... #endif
.................... BYTE *p;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
*
19C2: MOVFF 6DF,6ED
19C6: MOVFF 6DE,6EC
19CA: MOVFF 6DD,6EB
19CE: MOVFF 6DC,6EA
19D2: MOVLB 6
19D4: CLRF xF1
19D6: CLRF xF0
19D8: CLRF xEF
19DA: CLRF xEE
19DC: MOVLB 0
19DE: RCALL 1948
19E0: BC 19E4
19E2: BNZ 19EE
.................... return(0.0);
19E4: CLRF 00
19E6: CLRF 01
19E8: CLRF 02
19EA: CLRF 03
19EC: BRA 1ADE
....................
.................... y=x;
19EE: MOVFF 6DF,6E3
19F2: MOVFF 6DE,6E2
19F6: MOVFF 6DD,6E1
19FA: MOVFF 6DC,6E0
....................
.................... #if !defined(__PCD__)
.................... p=&y;
19FE: MOVLW 06
1A00: MOVLB 6
1A02: MOVWF xE9
1A04: MOVLW E0
1A06: MOVWF xE8
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1);
1A08: MOVFF 6E8,FE9
1A0C: MOVFF 6E9,FEA
1A10: MOVF FEF,W
1A12: CLRF xED
1A14: MOVWF xEC
1A16: MOVLW 7F
1A18: ADDWF xEC,F
1A1A: MOVLW 00
1A1C: ADDWFC xED,F
1A1E: BCF FD8.0
1A20: RRCF xED,W
1A22: RRCF xEC,W
1A24: MOVFF 6E9,FEA
1A28: MOVFF 6E8,FE9
1A2C: MOVWF FEF
.................... #endif
....................
.................... #if defined(__PCD__)
.................... p = (((unsigned int8 *)(&y))+3);
.................... data1 = *(((unsigned int8 *)(&y))+3);
.................... data2 = *(((unsigned int8 *)(&y))+2);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1 = ((data1+127) >>1);
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+3) = data1;
.................... *(((unsigned int8 *)(&y))+2) = data2;
....................
.................... #endif
....................
.................... do {
.................... res=y;
1A2E: MOVFF 6E3,6E7
1A32: MOVFF 6E2,6E6
1A36: MOVFF 6E1,6E5
1A3A: MOVFF 6E0,6E4
.................... y+=(x/y);
1A3E: MOVFF 6DF,6ED
1A42: MOVFF 6DE,6EC
1A46: MOVFF 6DD,6EB
1A4A: MOVFF 6DC,6EA
1A4E: MOVFF 6E3,6F1
1A52: MOVFF 6E2,6F0
1A56: MOVFF 6E1,6EF
1A5A: MOVFF 6E0,6EE
1A5E: MOVLB 0
1A60: RCALL 16BA
1A62: BCF FD8.1
1A64: MOVFF 6E3,6ED
1A68: MOVFF 6E2,6EC
1A6C: MOVFF 6E1,6EB
1A70: MOVFF 6E0,6EA
1A74: MOVFF 03,6F1
1A78: MOVFF 02,6F0
1A7C: MOVFF 01,6EF
1A80: MOVFF 00,6EE
1A84: RCALL 1442
1A86: MOVFF 03,6E3
1A8A: MOVFF 02,6E2
1A8E: MOVFF 01,6E1
1A92: MOVFF 00,6E0
....................
.................... #if !defined(__PCD__)
.................... (*p)--;
1A96: MOVLB 6
1A98: MOVFF 6E8,FE9
1A9C: MOVFF 6E9,FEA
1AA0: DECF FEF,F
.................... #endif
....................
.................... #if defined(__PCD__)
.................... data1 = *(((unsigned int8 *)(&y))+3);
.................... data2 = *(((unsigned int8 *)(&y))+2);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1--;
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+3) = data1;
.................... *(((unsigned int8 *)(&y))+2) = data2;
....................
.................... #endif
.................... } while(res != y);
1AA2: MOVFF 6E7,6ED
1AA6: MOVFF 6E6,6EC
1AAA: MOVFF 6E5,6EB
1AAE: MOVFF 6E4,6EA
1AB2: MOVFF 6E3,6F1
1AB6: MOVFF 6E2,6F0
1ABA: MOVFF 6E1,6EF
1ABE: MOVFF 6E0,6EE
1AC2: MOVLB 0
1AC4: RCALL 1948
1AC6: BTFSC FD8.2
1AC8: BRA 1ACE
1ACA: MOVLB 6
1ACC: BRA 1A2E
....................
.................... return(res);
1ACE: MOVFF 6E4,00
1AD2: MOVFF 6E5,01
1AD6: MOVFF 6E6,02
1ADA: MOVFF 6E7,03
.................... }
1ADE: GOTO 1CCA (RETURN)
.................... //Overloaded functions for sqrt() for PCD
.................... // Overloaded function sqrt() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 sqrt(float48 x)
.................... {
.................... float48 y, res;
.................... unsigned int16 data1,data2;
.................... BYTE *p;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
.................... return(0.0);
....................
.................... y=x;
....................
.................... #if !defined(__PCD__)
.................... p=&y;
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1);
.................... #endif
....................
.................... #if defined(__PCD__)
.................... p = (((unsigned int8 *)(&y))+5);
.................... data1 = *(((unsigned int8 *)(&y))+5);
.................... data2 = *(((unsigned int8 *)(&y))+4);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1 = ((data1+127) >>1);
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+5) = data1;
.................... *(((unsigned int8 *)(&y))+4) = data2;
....................
.................... #endif
....................
.................... do {
.................... res=y;
.................... y+=(x/y);
....................
.................... #if !defined(__PCD__)
.................... (*p)--;
.................... #endif
....................
.................... data1 = *(((unsigned int8 *)(&y))+5);
.................... data2 = *(((unsigned int8 *)(&y))+4);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1--;
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+5) = data1;
.................... *(((unsigned int8 *)(&y))+4) = data2;
....................
.................... } while(res != y);
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function sqrt() for data type - Float64
.................... float64 sqrt(float64 x)
.................... {
.................... float64 y, res;
.................... unsigned int16 *p;
.................... unsigned int16 temp1,temp2;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
.................... return(0.0);
....................
.................... y=x;
.................... p= (((unsigned int16 *)(&y))+3);
.................... temp1 = *p;
.................... temp2 = *p;
.................... bit_clear(temp1,15);
.................... temp1 = (temp1>>4)+1023;
.................... temp1 = temp1 >> 1;
.................... temp1 = (temp1<<4) & 0xFFF0;
.................... if(bit_test(temp2,15))
.................... bit_set(temp1,15);
.................... temp2 = temp2 & 0x000F;
.................... temp1 ^= temp2;
....................
.................... (*p) = temp1;
....................
.................... do {
.................... res=y;
.................... y+=(x/y);
.................... temp1 = *p;
.................... temp2 = *p;
.................... bit_clear(temp1,15);
.................... temp1 = (temp1>>4);
.................... temp1--;
.................... temp1 = (temp1<<4) & 0xFFF0;
.................... if(bit_test(temp2,15))
.................... bit_set(temp1,15);
.................... temp2 = temp2 & 0x000F;
.................... temp1 ^= temp2;
.................... (*p) = temp1;
....................
.................... } while(res != y);
....................
.................... return(res);
.................... }
.................... #endif
....................
.................... ////////////////////////////// Trig Functions //////////////////////////////
.................... #ifdef PI_DIV_BY_TWO
.................... #undef PI_DIV_BY_TWO
.................... #endif
.................... #define PI_DIV_BY_TWO 1.5707963267948966
.................... #ifdef TWOBYPI
.................... #undef TWOBYPI
.................... #define TWOBYPI 0.6366197723675813
.................... #endif
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float cos(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the cosine value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 cos(float32 x)
.................... {
.................... float32 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float32 frac;
.................... float32 p[4] = {
.................... -0.499999993585,
.................... 0.041666636258,
.................... -0.0013888361399,
.................... 0.00002476016134
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 0.999999999781;
.................... t = t * t;
.................... for (i = 0; i <= 3; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
....................
.................... //Overloaded functions for cos() for PCD
.................... // Overloaded function cos() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 cos(float48 x)
.................... {
.................... float48 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float48 frac;
.................... float48 p[4] = {
.................... -0.499999993585,
.................... 0.041666636258,
.................... -0.0013888361399,
.................... 0.00002476016134
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 0.999999999781;
.................... t = t * t;
.................... for (i = 0; i <= 3; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
.................... // Overloaded function cos() for data type - Float48
.................... float64 cos(float64 x)
.................... {
.................... float64 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float64 frac;
.................... float64 p[4] = {
.................... -0.499999993585,
.................... 0.041666636258,
.................... -0.0013888361399,
.................... 0.00002476016134
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 0.999999999781;
.................... t = t * t;
.................... for (i = 0; i <= 3; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float sin(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the sine value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 sin(float32 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
....................
.................... //Overloaded functions for sin() for PCD
.................... // Overloaded function sin() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 sin(float48 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
....................
.................... // Overloaded function sin() for data type - Float48
.................... float64 sin(float64 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float tan(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the tangent value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 tan(float32 x)
.................... {
.................... float32 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
.................... //Overloaded functions for tan() for PCD
.................... // Overloaded function tan() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 tan(float48 x)
.................... {
.................... float48 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
....................
.................... // Overloaded function tan() for data type - Float48
.................... float64 tan(float64 x)
.................... {
.................... float64 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
.................... #endif
....................
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290};
.................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290};
....................
.................... float32 ASIN_COS(float32 x, unsigned int8 n)
.................... {
.................... float32 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
....................
.................... //Overloaded functions for ASIN_COS() for PCD
.................... // Overloaded function ASIN_COS() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 ASIN_COS(float48 x, unsigned int8 n)
.................... {
.................... float48 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function ASIN_COS() for data type - Float64
.................... float64 ASIN_COS(float64 x, unsigned int8 n)
.................... {
.................... float64 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float asin(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arcsine value of the value x.
.................... // Date : N/A
.................... //
.................... float32 asin(float32 x)
.................... {
.................... float32 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
.................... //Overloaded functions for asin() for PCD
.................... // Overloaded function asin() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 asin(float48 x)
.................... {
.................... float48 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
....................
.................... // Overloaded function asin() for data type - Float64
.................... float64 asin(float64 x)
.................... {
.................... float64 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float acos(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arccosine value of the value x.
.................... // Date : N/A
.................... //
.................... float32 acos(float32 x)
.................... {
.................... float32 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
.................... //Overloaded functions for acos() for PCD
.................... // Overloaded function acos() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 acos(float48 x)
.................... {
.................... float48 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
....................
.................... // Overloaded function acos() for data type - Float64
.................... float64 acos(float64 x)
.................... {
.................... float64 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
.................... #endif
....................
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457};
.................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457};
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float atan(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arctangent value of the value x.
.................... // Date : N/A
.................... //
.................... float32 atan(float32 x)
.................... {
.................... float32 y, res, r;
.................... int1 s, flag;
....................
.................... s = 0;
.................... flag = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 1.0)
.................... {
.................... y = 1.0/y;
.................... flag = 1;
.................... }
....................
.................... res = pat[0]*y*y + pat[1];
.................... res = res*y*y + pat[2];
.................... res = res*y*y + pat[3];
....................
.................... r = qat[0]*y*y + qat[1];
.................... r = r*y*y + qat[2];
.................... r = r*y*y + qat[3];
....................
.................... res = y*res/r;
....................
....................
.................... if (flag) // for |x| > 1
.................... res = PI_DIV_BY_TWO - res;
.................... if (s)
.................... res = -res;
....................
.................... return(res);
.................... }
.................... //Overloaded functions for atan() for PCD
.................... // Overloaded function atan() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 atan(float48 x)
.................... {
.................... float48 y, res, r;
.................... int1 s, flag;
....................
.................... s = 0;
.................... flag = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 1.0)
.................... {
.................... y = 1.0/y;
.................... flag = 1;
.................... }
....................
.................... res = pat[0]*y*y + pat[1];
.................... res = res*y*y + pat[2];
.................... res = res*y*y + pat[3];
....................
.................... r = qat[0]*y*y + qat[1];
.................... r = r*y*y + qat[2];
.................... r = r*y*y + qat[3];
....................
.................... res = y*res/r;
....................
....................
.................... if (flag) // for |x| > 1
.................... res = PI_DIV_BY_TWO - res;
.................... if (s)
.................... res = -res;
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function atan() for data type - Float64
.................... float64 atan(float64 x)
.................... {
.................... float64 y, res, r;
.................... int1 s, flag;
....................
.................... s = 0;
.................... flag = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 1.0)
.................... {
.................... y = 1.0/y;
.................... flag = 1;
.................... }
....................
.................... res = pat[0]*y*y + pat[1];
.................... res = res*y*y + pat[2];
.................... res = res*y*y + pat[3];
....................
.................... r = qat[0]*y*y + qat[1];
.................... r = r*y*y + qat[2];
.................... r = r*y*y + qat[3];
....................
.................... res = y*res/r;
....................
....................
.................... if (flag) // for |x| > 1
.................... res = PI_DIV_BY_TWO - res;
.................... if (s)
.................... res = -res;
....................
.................... return(res);
.................... }
.................... #endif
....................
.................... /////////////////////////////////////////////////////////////////////////////
.................... // float atan2(float y, float x)
.................... /////////////////////////////////////////////////////////////////////////////
.................... // Description :computes the principal value of arc tangent of y/x, using the
.................... // signs of both the arguments to determine the quadrant of the return value
.................... // Returns : returns the arc tangent of y/x.
.................... // Date : N/A
.................... //
....................
.................... float32 atan2(float32 y,float32 x)
.................... {
.................... float32 z;
.................... int1 sign;
.................... unsigned int8 quad;
.................... sign=0;
.................... quad=0; //quadrant
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
.................... if(y<0.0)
.................... {
.................... sign=1;
.................... y=-y;
.................... }
.................... if(x<0.0)
.................... {
.................... x=-x;
.................... }
.................... if (x==0.0)
.................... {
.................... if(y==0.0)
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... else
.................... {
.................... if(sign)
.................... {
.................... return (-(PI_DIV_BY_TWO));
.................... }
.................... else
.................... {
.................... return (PI_DIV_BY_TWO);
.................... }
.................... }
.................... }
.................... else
.................... {
.................... z=y/x;
.................... switch(quad)
.................... {
.................... case 1:
.................... {
.................... return atan(z);
.................... break;
.................... }
.................... case 2:
.................... {
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
.................... return (PI-atan(z));
.................... break;
.................... }
.................... case 3:
.................... {
.................... return (atan(z)-PI);
.................... break;
.................... }
.................... case 4:
.................... {
.................... return (-atan(z));
.................... break;
.................... }
.................... }
.................... }
.................... }
....................
.................... //Overloaded functions for atan2() for PCD
.................... // Overloaded function atan2() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 atan2(float48 y,float48 x)
.................... {
.................... float48 z;
.................... int1 sign;
.................... unsigned int8 quad;
.................... sign=0;
.................... quad=0; //quadrant
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
.................... if(y<0.0)
.................... {
.................... sign=1;
.................... y=-y;
.................... }
.................... if(x<0.0)
.................... {
.................... x=-x;
.................... }
.................... if (x==0.0)
.................... {
.................... if(y==0.0)
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... else
.................... {
.................... if(sign)
.................... {
.................... return (-(PI_DIV_BY_TWO));
.................... }
.................... else
.................... {
.................... return (PI_DIV_BY_TWO);
.................... }
.................... }
.................... }
.................... else
.................... {
.................... z=y/x;
.................... switch(quad)
.................... {
.................... case 1:
.................... {
.................... return atan(z);
.................... break;
.................... }
.................... case 2:
.................... {
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
.................... return (PI-atan(z));
.................... break;
.................... }
.................... case 3:
.................... {
.................... return (atan(z)-PI);
.................... break;
.................... }
.................... case 4:
.................... {
.................... return (-atan(z));
.................... break;
.................... }
.................... }
.................... }
.................... }
....................
.................... // Overloaded function atan2() for data type - Float64
.................... float64 atan2(float64 y,float64 x)
.................... {
.................... float64 z;
.................... int1 sign;
.................... unsigned int8 quad;
.................... sign=0;
.................... quad=0; //quadrant
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
.................... if(y<0.0)
.................... {
.................... sign=1;
.................... y=-y;
.................... }
.................... if(x<0.0)
.................... {
.................... x=-x;
.................... }
.................... if (x==0.0)
.................... {
.................... if(y==0.0)
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... else
.................... {
.................... if(sign)
.................... {
.................... return (-(PI_DIV_BY_TWO));
.................... }
.................... else
.................... {
.................... return (PI_DIV_BY_TWO);
.................... }
.................... }
.................... }
.................... else
.................... {
.................... z=y/x;
.................... switch(quad)
.................... {
.................... case 1:
.................... {
.................... return atan(z);
.................... break;
.................... }
.................... case 2:
.................... {
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
.................... return (PI-atan(z));
.................... break;
.................... }
.................... case 3:
.................... {
.................... return (atan(z)-PI);
.................... break;
.................... }
.................... case 4:
.................... {
.................... return (-atan(z));
.................... break;
.................... }
.................... }
.................... }
.................... }
.................... #endif
....................
.................... //////////////////// Hyperbolic functions ////////////////////
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float cosh(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the hyperbolic cosine value of x
.................... // Returns : returns the hyperbolic cosine value of x
.................... // Date : N/A
.................... //
....................
.................... float32 cosh(float32 x)
.................... {
.................... return ((exp(x)+exp(-x))/2);
.................... }
.................... //Overloaded functions for cosh() for PCD
.................... // Overloaded function cosh() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 cosh(float48 x)
.................... {
.................... return ((exp(x)+exp(-x))/2);
.................... }
....................
.................... // Overloaded function cosh() for data type - Float64
.................... float64 cosh(float64 x)
.................... {
.................... return ((exp(x)+exp(-x))/2);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float sinh(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the hyperbolic sine value of x
.................... // Returns : returns the hyperbolic sine value of x
.................... // Date : N/A
.................... //
....................
.................... float32 sinh(float32 x)
.................... {
....................
.................... return ((exp(x) - exp(-x))/2);
.................... }
.................... //Overloaded functions for sinh() for PCD
.................... // Overloaded function sinh() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 sinh(float48 x)
.................... {
....................
.................... return ((exp(x) - exp(-x))/2);
.................... }
....................
.................... // Overloaded function sinh() for data type - Float48
.................... float64 sinh(float64 x)
.................... {
....................
.................... return ((exp(x) - exp(-x))/2);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float tanh(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the hyperbolic tangent value of x
.................... // Returns : returns the hyperbolic tangent value of x
.................... // Date : N/A
.................... //
....................
.................... float32 tanh(float32 x)
.................... {
.................... return(sinh(x)/cosh(x));
.................... }
.................... //Overloaded functions for tanh() for PCD
.................... // Overloaded function tanh() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 tanh(float48 x)
.................... {
.................... return(sinh(x)/cosh(x));
.................... }
....................
.................... // Overloaded function tanh() for data type - Float64
.................... float64 tanh(float64 x)
.................... {
.................... return(sinh(x)/cosh(x));
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float frexp(float x, signed int *exp)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : breaks a floating point number into a normalized fraction and an integral
.................... // power of 2. It stores the integer in the signed int object pointed to by exp.
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero,
.................... // both parts of the result are zero.
.................... // Date : N/A
.................... //
....................
.................... #define LOG2 .30102999566398119521
.................... float32 frexp(float32 x, signed int8 *exp)
.................... {
.................... float32 res;
.................... int1 sign = 0;
.................... if(x == 0.0)
.................... {
.................... *exp=0;
.................... return (0.0);
.................... }
.................... if(x < 0.0)
.................... {
.................... x=-x;
.................... sign=1;
.................... }
.................... if (x > 1.0)
.................... {
.................... *exp=(ceil(log10(x)/LOG2));
.................... res=x/(pow(2, *exp));
.................... if (res == 1)
.................... {
.................... *exp=*exp+1;
.................... res=.5;
.................... }
.................... }
.................... else
.................... {
.................... if(x < 0.5)
.................... {
.................... *exp=-1;
.................... res=x*2;
.................... }
.................... else
.................... {
.................... *exp=0;
.................... res=x;
.................... }
.................... }
.................... if(sign)
.................... {
.................... res=-res;
.................... }
.................... return res;
.................... }
....................
.................... //Overloaded functions for frexp() for PCD
.................... // Overloaded function frexp() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 frexp(float48 x, signed int8 *exp)
.................... {
.................... float48 res;
.................... int1 sign = 0;
.................... if(x == 0.0)
.................... {
.................... *exp=0;
.................... return (0.0);
.................... }
.................... if(x < 0.0)
.................... {
.................... x=-x;
.................... sign=1;
.................... }
.................... if (x > 1.0)
.................... {
.................... *exp=(ceil(log10(x)/LOG2));
.................... res=x/(pow(2, *exp));
.................... if (res == 1)
.................... {
.................... *exp=*exp+1;
.................... res=.5;
.................... }
.................... }
.................... else
.................... {
.................... if(x < 0.5)
.................... {
.................... *exp=-1;
.................... res=x*2;
.................... }
.................... else
.................... {
.................... *exp=0;
.................... res=x;
.................... }
.................... }
.................... if(sign)
.................... {
.................... res=-res;
.................... }
.................... return res;
.................... }
....................
.................... // Overloaded function frexp() for data type - Float64
.................... float64 frexp(float64 x, signed int8 *exp)
.................... {
.................... float64 res;
.................... int1 sign = 0;
.................... if(x == 0.0)
.................... {
.................... *exp=0;
.................... return (0.0);
.................... }
.................... if(x < 0.0)
.................... {
.................... x=-x;
.................... sign=1;
.................... }
.................... if (x > 1.0)
.................... {
.................... *exp=(ceil(log10(x)/LOG2));
.................... res=x/(pow(2, *exp));
.................... if (res == 1)
.................... {
.................... *exp=*exp+1;
.................... res=.5;
.................... }
.................... }
.................... else
.................... {
.................... if(x < 0.5)
.................... {
.................... *exp=-1;
.................... res=x*2;
.................... }
.................... else
.................... {
.................... *exp=0;
.................... res=x;
.................... }
.................... }
.................... if(sign)
.................... {
.................... res=-res;
.................... }
.................... return res;
.................... }
.................... #endif
....................
.................... //////////////////////////////////////////////////////////////////////////////
.................... // float ldexp(float x, signed int *exp)
.................... //////////////////////////////////////////////////////////////////////////////
.................... // Description : multiplies a floating point number by an integral power of 2.
.................... // Returns : returns the value of x times 2 raised to the power exp.
.................... // Date : N/A
.................... //
....................
.................... float32 ldexp(float32 value, signed int8 exp)
.................... {
.................... return (value * pow(2,exp));
.................... }
.................... //Overloaded functions for ldexp() for PCD
.................... // Overloaded function ldexp() for data type - Float48
....................
.................... #if defined(__PCD__)
.................... float48 ldexp(float48 value, signed int8 exp)
.................... {
.................... return (value * pow(2,exp));
.................... }
.................... // Overloaded function ldexp() for data type - Float64
.................... float64 ldexp(float64 value, signed int8 exp)
.................... {
.................... return (value * pow(2,exp));
.................... }
.................... #endif
....................
.................... #endif
....................
....................
.................... float quadraticerror(float average, float buf[], int16 size) // compute average quadratic error
.................... {
.................... int16 i;
.................... float err=0;
1AE2: MOVLB 6
1AE4: CLRF xD4
1AE6: CLRF xD5
1AE8: CLRF xD6
1AEA: CLRF xD7
....................
.................... for(i=0; i<size; i++) err += (buf[i]-average)*(buf[i]-average); // sum quadratic errors
1AEC: CLRF xD3
1AEE: CLRF xD2
1AF0: MOVF xD3,W
1AF2: SUBWF xD1,W
1AF4: BTFSS FD8.0
1AF6: BRA 1C48
1AF8: BNZ 1B02
1AFA: MOVF xD0,W
1AFC: SUBWF xD2,W
1AFE: BTFSC FD8.0
1B00: BRA 1C48
1B02: RLCF xD2,W
1B04: MOVWF 02
1B06: RLCF xD3,W
1B08: MOVWF 03
1B0A: RLCF 02,F
1B0C: RLCF 03,F
1B0E: MOVLW FC
1B10: ANDWF 02,F
1B12: MOVF 02,W
1B14: ADDWF xCE,W
1B16: MOVWF FE9
1B18: MOVF xCF,W
1B1A: ADDWFC 03,W
1B1C: MOVWF FEA
1B1E: MOVFF FEF,6D8
1B22: MOVFF FEC,6D9
1B26: MOVFF FEC,6DA
1B2A: MOVFF FEC,6DB
1B2E: MOVFF FEA,6DD
1B32: MOVFF FE9,6DC
1B36: BSF FD8.1
1B38: MOVFF 6DB,6ED
1B3C: MOVFF 6DA,6EC
1B40: MOVFF 6D9,6EB
1B44: MOVFF 6D8,6EA
1B48: MOVFF 6CD,6F1
1B4C: MOVFF 6CC,6F0
1B50: MOVFF 6CB,6EF
1B54: MOVFF 6CA,6EE
1B58: MOVLB 0
1B5A: RCALL 1442
1B5C: MOVFF 6DD,FEA
1B60: MOVFF 6DC,FE9
1B64: MOVFF 00,6D8
1B68: MOVFF 01,6D9
1B6C: MOVFF 02,6DA
1B70: MOVFF 03,6DB
1B74: MOVLB 6
1B76: RLCF xD2,W
1B78: MOVWF 02
1B7A: RLCF xD3,W
1B7C: MOVWF 03
1B7E: RLCF 02,F
1B80: RLCF 03,F
1B82: MOVLW FC
1B84: ANDWF 02,F
1B86: MOVF 02,W
1B88: ADDWF xCE,W
1B8A: MOVWF FE9
1B8C: MOVF xCF,W
1B8E: ADDWFC 03,W
1B90: MOVWF FEA
1B92: MOVFF FEF,6DE
1B96: MOVFF FEC,6DF
1B9A: MOVFF FEC,6E0
1B9E: MOVFF FEC,6E1
1BA2: MOVFF FEA,6E3
1BA6: MOVFF FE9,6E2
1BAA: BSF FD8.1
1BAC: MOVFF 6E1,6ED
1BB0: MOVFF 6E0,6EC
1BB4: MOVFF 6DF,6EB
1BB8: MOVFF 6DE,6EA
1BBC: MOVFF 6CD,6F1
1BC0: MOVFF 6CC,6F0
1BC4: MOVFF 6CB,6EF
1BC8: MOVFF 6CA,6EE
1BCC: MOVLB 0
1BCE: RCALL 1442
1BD0: MOVFF 6E3,FEA
1BD4: MOVFF 6E2,FE9
1BD8: MOVFF 6DB,6E7
1BDC: MOVFF 6DA,6E6
1BE0: MOVFF 6D9,6E5
1BE4: MOVFF 6D8,6E4
1BE8: MOVFF 03,6EB
1BEC: MOVFF 02,6EA
1BF0: MOVFF 01,6E9
1BF4: MOVFF 00,6E8
1BF8: RCALL 1852
1BFA: MOVFF FEA,6D9
1BFE: MOVFF FE9,6D8
1C02: BCF FD8.1
1C04: MOVFF 6D7,6ED
1C08: MOVFF 6D6,6EC
1C0C: MOVFF 6D5,6EB
1C10: MOVFF 6D4,6EA
1C14: MOVFF 03,6F1
1C18: MOVFF 02,6F0
1C1C: MOVFF 01,6EF
1C20: MOVFF 00,6EE
1C24: RCALL 1442
1C26: MOVFF 6D9,FEA
1C2A: MOVFF 6D8,FE9
1C2E: MOVFF 03,6D7
1C32: MOVFF 02,6D6
1C36: MOVFF 01,6D5
1C3A: MOVFF 00,6D4
1C3E: MOVLB 6
1C40: INCF xD2,F
1C42: BTFSC FD8.2
1C44: INCF xD3,F
1C46: BRA 1AF0
.................... err = sqrt((1/(float)size)*err);
1C48: MOVFF 6D1,6D9
1C4C: MOVFF 6D0,6D8
1C50: MOVLB 0
1C52: CALL 140C
1C56: MOVLB 6
1C58: CLRF xED
1C5A: CLRF xEC
1C5C: CLRF xEB
1C5E: MOVLW 7F
1C60: MOVWF xEA
1C62: MOVFF 03,6F1
1C66: MOVFF 02,6F0
1C6A: MOVFF 01,6EF
1C6E: MOVFF 00,6EE
1C72: MOVLB 0
1C74: RCALL 16BA
1C76: MOVFF 00,6D8
1C7A: MOVFF 01,6D9
1C7E: MOVFF 02,6DA
1C82: MOVFF 03,6DB
1C86: MOVFF 03,6E7
1C8A: MOVFF 02,6E6
1C8E: MOVFF 01,6E5
1C92: MOVFF 00,6E4
1C96: MOVFF 6D7,6EB
1C9A: MOVFF 6D6,6EA
1C9E: MOVFF 6D5,6E9
1CA2: MOVFF 6D4,6E8
1CA6: RCALL 1852
1CA8: MOVFF 00,6D8
1CAC: MOVFF 01,6D9
1CB0: MOVFF 02,6DA
1CB4: MOVFF 03,6DB
1CB8: MOVFF 03,6DF
1CBC: MOVFF 02,6DE
1CC0: MOVFF 01,6DD
1CC4: MOVFF 00,6DC
1CC8: BRA 19C2
1CCA: MOVFF 03,6D7
1CCE: MOVFF 02,6D6
1CD2: MOVFF 01,6D5
1CD6: MOVFF 00,6D4
.................... return err;
1CDA: MOVFF 6D4,00
1CDE: MOVFF 6D5,01
1CE2: MOVFF 6D6,02
1CE6: MOVFF 6D7,03
.................... }
1CEA: RETLW 00
....................
.................... void main()
.................... {
*
1F62: CLRF FF8
1F64: BCF FD0.7
1F66: BSF 08.7
1F68: CLRF FEA
1F6A: CLRF FE9
1F6C: MOVF FC1,W
1F6E: ANDLW C0
1F70: IORLW 0F
1F72: MOVWF FC1
1F74: MOVLW 07
1F76: MOVWF FB4
1F78: CLRF 21
1F7A: MOVLW 04
1F7C: MOVWF 22
1F7E: MOVLW 0C
1F80: MOVWF 23
1F82: CLRF 24
1F84: CLRF 28
1F86: CLRF x7C
1F88: CLRF x83
....................
.................... float x[BUFLEN], y[BUFLEN], z[BUFLEN];
.................... float xavg, yavg, zavg;
.................... int i;
.................... port_b_pullups(FALSE);
1F8A: BSF FF1.7
.................... setup_psp(PSP_DISABLED);
1F8C: BCF FB0.4
.................... setup_spi(SPI_SS_DISABLED);
1F8E: BCF FC6.5
1F90: BCF F94.7
1F92: BSF F93.0
1F94: BCF F93.1
1F96: MOVLW 01
1F98: MOVWF FC6
1F9A: MOVLW 00
1F9C: MOVWF FC7
.................... setup_wdt(WDT_OFF);
1F9E: BCF FD1.0
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
1FA0: MOVLW 87
1FA2: MOVWF FD5
.................... setup_timer_1(T1_DISABLED);
1FA4: CLRF FCD
.................... setup_timer_2(T2_DISABLED,0,1);
1FA6: MOVLW 00
1FA8: MOVWF FCA
1FAA: MOVLW 00
1FAC: MOVWF FCB
.................... setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
1FAE: CLRF FB1
.................... setup_comparator(NC_NC_NC_NC);
1FB0: MOVLW 07
1FB2: MOVWF FB4
1FB4: MOVF F92,W
1FB6: MOVWF F92
1FB8: MOVLW 13
1FBA: MOVWF 00
1FBC: DECFSZ 00,F
1FBE: BRA 1FBC
1FC0: BRA 1FC2
1FC2: MOVF FB4,W
1FC4: BCF FA1.6
.................... setup_vref(FALSE);
1FC6: CLRF FB5
.................... enable_interrupts(INT_TIMER0);
1FC8: BSF FF2.5
.................... enable_interrupts(GLOBAL);
1FCA: MOVLW C0
1FCC: IORWF FF2,F
....................
.................... setup_adc_ports(AN0_TO_AN2|VSS_VREF);
1FCE: MOVF FC1,W
1FD0: ANDLW C0
1FD2: IORLW 1C
1FD4: MOVWF FC1
.................... setup_adc(ADC_CLOCK_DIV_64);
1FD6: BCF FC0.0
1FD8: BSF FC0.1
1FDA: BSF FC0.2
1FDC: BSF FC0.7
1FDE: BSF FC2.0
....................
.................... usb_init(); // initialise USB module
1FE0: GOTO 1368
....................
.................... while (TRUE)
.................... {
....................
.................... while(!usb_cdc_connected());
1FE4: BTFSS x80.0
1FE6: BRA 1FE4
.................... time=0;
1FE8: CLRF 1C
1FEA: CLRF 1B
1FEC: CLRF 1A
1FEE: CLRF 19
.................... set_timer0(0);
1FF0: CLRF FD7
1FF2: CLRF FD6
.................... printf(usb_cdc_putc,"time[s] X Xerr Y Yerr Z Zerr \n\r");
1FF4: MOVLB 3
1FF6: CLRF xB1
1FF8: MOVF xB1,W
1FFA: MOVLB 0
1FFC: CALL 021E
2000: MOVLB 3
2002: INCF xB1,F
2004: MOVWF 00
2006: MOVFF FE8,6DB
200A: MOVLB 0
200C: CALL 13D4
2010: MOVLW 25
2012: MOVLB 3
2014: SUBWF xB1,W
2016: BNZ 1FF8
....................
.................... while(usb_cdc_connected()) // pockej nez se pripoji seriovy port PC
.................... {
2018: MOVLB 0
201A: BTFSS x80.0
201C: BRA 25DE
.................... for(i=0; i <BUFLEN; i++)
201E: MOVLB 3
2020: CLRF xB0
2022: MOVF xB0,W
2024: SUBLW 63
2026: BTFSS FD8.0
2028: BRA 2300
.................... {
.................... set_adc_channel(0);
202A: MOVLW 00
202C: MOVWF 01
202E: MOVF FC2,W
2030: ANDLW C3
2032: IORWF 01,W
2034: MOVWF FC2
.................... delay_us(10);
2036: MOVLW 13
2038: MOVWF 00
203A: DECFSZ 00,F
203C: BRA 203A
203E: BRA 2040
2040: CLRF 18
2042: BTFSC FF2.7
2044: BSF 18.7
2046: BCF FF2.7
.................... x[i]=read_adc();
2048: MOVLB 7
204A: CLRF x49
204C: MOVFF 3B0,748
2050: CLRF x4B
2052: MOVLW 04
2054: MOVWF x4A
2056: MOVLB 0
2058: CALL 02BA
205C: BTFSC 18.7
205E: BSF FF2.7
2060: MOVFF 02,03
2064: MOVF 01,W
2066: ADDLW 84
2068: MOVWF FE9
206A: MOVLW 00
206C: ADDWFC 02,W
206E: MOVWF FEA
2070: BSF FC2.1
2072: BTFSC FC2.1
2074: BRA 2072
2076: MOVFF FC4,6D9
207A: MOVFF FC3,6D8
207E: MOVLB 0
2080: CALL 140C
2084: MOVFF 00,FEF
2088: MOVFF 01,FEC
208C: MOVFF 02,FEC
2090: MOVFF 03,FEC
2094: CLRF 18
2096: BTFSC FF2.7
2098: BSF 18.7
209A: BCF FF2.7
.................... xavg+=x[i];
209C: MOVLB 7
209E: CLRF x49
20A0: MOVFF 3B0,748
20A4: CLRF x4B
20A6: MOVLW 04
20A8: MOVWF x4A
20AA: MOVLB 0
20AC: CALL 02BA
20B0: BTFSC 18.7
20B2: BSF FF2.7
20B4: MOVFF 02,03
20B8: MOVF 01,W
20BA: ADDLW 84
20BC: MOVWF FE9
20BE: MOVLW 00
20C0: ADDWFC 02,W
20C2: MOVWF FEA
20C4: MOVFF FEF,00
20C8: MOVFF FEC,01
20CC: MOVFF FEC,02
20D0: MOVFF FEC,03
20D4: MOVFF FEA,3B2
20D8: MOVFF FE9,3B1
20DC: BCF FD8.1
20DE: MOVFF 3A7,6ED
20E2: MOVFF 3A6,6EC
20E6: MOVFF 3A5,6EB
20EA: MOVFF 3A4,6EA
20EE: MOVFF 03,6F1
20F2: MOVFF 02,6F0
20F6: MOVFF 01,6EF
20FA: MOVFF 00,6EE
20FE: CALL 1442
2102: MOVFF 3B2,FEA
2106: MOVFF 3B1,FE9
210A: MOVFF 03,3A7
210E: MOVFF 02,3A6
2112: MOVFF 01,3A5
2116: MOVFF 00,3A4
....................
.................... set_adc_channel(1);
211A: MOVLW 04
211C: MOVWF 01
211E: MOVF FC2,W
2120: ANDLW C3
2122: IORWF 01,W
2124: MOVWF FC2
.................... delay_us(10);
2126: MOVLW 13
2128: MOVWF 00
212A: DECFSZ 00,F
212C: BRA 212A
212E: BRA 2130
2130: CLRF 18
2132: BTFSC FF2.7
2134: BSF 18.7
2136: BCF FF2.7
.................... y[i]=read_adc();
2138: MOVLB 7
213A: CLRF x49
213C: MOVFF 3B0,748
2140: CLRF x4B
2142: MOVLW 04
2144: MOVWF x4A
2146: MOVLB 0
2148: CALL 02BA
214C: BTFSC 18.7
214E: BSF FF2.7
2150: MOVFF 02,03
2154: MOVF 01,W
2156: ADDLW 14
2158: MOVWF FE9
215A: MOVLW 02
215C: ADDWFC 02,W
215E: MOVWF FEA
2160: BSF FC2.1
2162: BTFSC FC2.1
2164: BRA 2162
2166: MOVFF FC4,6D9
216A: MOVFF FC3,6D8
216E: MOVLB 0
2170: CALL 140C
2174: MOVFF 00,FEF
2178: MOVFF 01,FEC
217C: MOVFF 02,FEC
2180: MOVFF 03,FEC
2184: CLRF 18
2186: BTFSC FF2.7
2188: BSF 18.7
218A: BCF FF2.7
.................... yavg+=y[i];
218C: MOVLB 7
218E: CLRF x49
2190: MOVFF 3B0,748
2194: CLRF x4B
2196: MOVLW 04
2198: MOVWF x4A
219A: MOVLB 0
219C: CALL 02BA
21A0: BTFSC 18.7
21A2: BSF FF2.7
21A4: MOVFF 02,03
21A8: MOVF 01,W
21AA: ADDLW 14
21AC: MOVWF FE9
21AE: MOVLW 02
21B0: ADDWFC 02,W
21B2: MOVWF FEA
21B4: MOVFF FEF,00
21B8: MOVFF FEC,01
21BC: MOVFF FEC,02
21C0: MOVFF FEC,03
21C4: MOVFF FEA,3B2
21C8: MOVFF FE9,3B1
21CC: BCF FD8.1
21CE: MOVFF 3AB,6ED
21D2: MOVFF 3AA,6EC
21D6: MOVFF 3A9,6EB
21DA: MOVFF 3A8,6EA
21DE: MOVFF 03,6F1
21E2: MOVFF 02,6F0
21E6: MOVFF 01,6EF
21EA: MOVFF 00,6EE
21EE: CALL 1442
21F2: MOVFF 3B2,FEA
21F6: MOVFF 3B1,FE9
21FA: MOVFF 03,3AB
21FE: MOVFF 02,3AA
2202: MOVFF 01,3A9
2206: MOVFF 00,3A8
....................
.................... set_adc_channel(2);
220A: MOVLW 08
220C: MOVWF 01
220E: MOVF FC2,W
2210: ANDLW C3
2212: IORWF 01,W
2214: MOVWF FC2
.................... delay_us(10);
2216: MOVLW 13
2218: MOVWF 00
221A: DECFSZ 00,F
221C: BRA 221A
221E: BRA 2220
2220: CLRF 18
2222: BTFSC FF2.7
2224: BSF 18.7
2226: BCF FF2.7
.................... z[i]=read_adc();
2228: MOVLB 7
222A: CLRF x49
222C: MOVFF 3B0,748
2230: CLRF x4B
2232: MOVLW 04
2234: MOVWF x4A
2236: MOVLB 0
2238: CALL 02BA
223C: BTFSC 18.7
223E: BSF FF2.7
2240: MOVFF 02,03
2244: MOVF 01,W
2246: ADDLW 20
2248: MOVWF FE9
224A: MOVLW 05
224C: ADDWFC 02,W
224E: MOVWF FEA
2250: BSF FC2.1
2252: BTFSC FC2.1
2254: BRA 2252
2256: MOVFF FC4,6D9
225A: MOVFF FC3,6D8
225E: MOVLB 0
2260: CALL 140C
2264: MOVFF 00,FEF
2268: MOVFF 01,FEC
226C: MOVFF 02,FEC
2270: MOVFF 03,FEC
2274: CLRF 18
2276: BTFSC FF2.7
2278: BSF 18.7
227A: BCF FF2.7
.................... zavg+=z[i];
227C: MOVLB 7
227E: CLRF x49
2280: MOVFF 3B0,748
2284: CLRF x4B
2286: MOVLW 04
2288: MOVWF x4A
228A: MOVLB 0
228C: CALL 02BA
2290: BTFSC 18.7
2292: BSF FF2.7
2294: MOVFF 02,03
2298: MOVF 01,W
229A: ADDLW 20
229C: MOVWF FE9
229E: MOVLW 05
22A0: ADDWFC 02,W
22A2: MOVWF FEA
22A4: MOVFF FEF,00
22A8: MOVFF FEC,01
22AC: MOVFF FEC,02
22B0: MOVFF FEC,03
22B4: MOVFF FEA,3B2
22B8: MOVFF FE9,3B1
22BC: BCF FD8.1
22BE: MOVFF 3AF,6ED
22C2: MOVFF 3AE,6EC
22C6: MOVFF 3AD,6EB
22CA: MOVFF 3AC,6EA
22CE: MOVFF 03,6F1
22D2: MOVFF 02,6F0
22D6: MOVFF 01,6EF
22DA: MOVFF 00,6EE
22DE: CALL 1442
22E2: MOVFF 3B2,FEA
22E6: MOVFF 3B1,FE9
22EA: MOVFF 03,3AF
22EE: MOVFF 02,3AE
22F2: MOVFF 01,3AD
22F6: MOVFF 00,3AC
.................... }
22FA: MOVLB 3
22FC: INCF xB0,F
22FE: BRA 2022
....................
.................... xavg=xavg/BUFLEN;
2300: MOVFF 3A7,6ED
2304: MOVFF 3A6,6EC
2308: MOVFF 3A5,6EB
230C: MOVFF 3A4,6EA
2310: MOVLB 6
2312: CLRF xF1
2314: CLRF xF0
2316: MOVLW 48
2318: MOVWF xEF
231A: MOVLW 85
231C: MOVWF xEE
231E: MOVLB 0
2320: CALL 16BA
2324: MOVFF 03,3A7
2328: MOVFF 02,3A6
232C: MOVFF 01,3A5
2330: MOVFF 00,3A4
.................... yavg=yavg/BUFLEN;
2334: MOVFF 3AB,6ED
2338: MOVFF 3AA,6EC
233C: MOVFF 3A9,6EB
2340: MOVFF 3A8,6EA
2344: MOVLB 6
2346: CLRF xF1
2348: CLRF xF0
234A: MOVLW 48
234C: MOVWF xEF
234E: MOVLW 85
2350: MOVWF xEE
2352: MOVLB 0
2354: CALL 16BA
2358: MOVFF 03,3AB
235C: MOVFF 02,3AA
2360: MOVFF 01,3A9
2364: MOVFF 00,3A8
.................... zavg=zavg/BUFLEN;
2368: MOVFF 3AF,6ED
236C: MOVFF 3AE,6EC
2370: MOVFF 3AD,6EB
2374: MOVFF 3AC,6EA
2378: MOVLB 6
237A: CLRF xF1
237C: CLRF xF0
237E: MOVLW 48
2380: MOVWF xEF
2382: MOVLW 85
2384: MOVWF xEE
2386: MOVLB 0
2388: CALL 16BA
238C: MOVFF 03,3AF
2390: MOVFF 02,3AE
2394: MOVFF 01,3AD
2398: MOVFF 00,3AC
....................
.................... // odesli namerene hodnoty
.................... printf(usb_cdc_putc, "%7.3f %4.3f %4.3f %4.3f %4.3f %4.3f %4.3f \n\r",((time << 16) + get_timer0())/15625.0, xavg, quadraticerror(xavg,x,BUFLEN), yavg, quadraticerror(yavg,y,BUFLEN), zavg, quadraticerror(zavg,z,BUFLEN)); //konstanta k je kvuli prevodu do rozzumnych jednotek [s]
239C: MOVFF 1A,3B5
23A0: MOVFF 19,3B4
23A4: MOVLB 3
23A6: CLRF xB2
23A8: CLRF xB3
23AA: MOVF FD6,W
23AC: MOVFF FD7,03
23B0: ADDWF xB2,F
23B2: MOVF FD7,W
23B4: ADDWFC xB3,F
23B6: MOVLW 00
23B8: ADDWFC xB4,F
23BA: ADDWFC xB5,F
23BC: MOVFF 3B5,6C5
23C0: MOVFF 3B4,6C4
23C4: MOVFF 3B3,6C3
23C8: MOVFF 3B2,6C2
23CC: MOVLB 0
23CE: GOTO 1818
23D2: MOVFF 03,6ED
23D6: MOVFF 02,6EC
23DA: MOVFF 01,6EB
23DE: MOVFF 00,6EA
23E2: MOVLB 6
23E4: CLRF xF1
23E6: MOVLW 24
23E8: MOVWF xF0
23EA: MOVLW 74
23EC: MOVWF xEF
23EE: MOVLW 8C
23F0: MOVWF xEE
23F2: MOVLB 0
23F4: CALL 16BA
23F8: MOVFF 00,3B2
23FC: MOVFF 01,3B3
2400: MOVFF 02,3B4
2404: MOVFF 03,3B5
2408: MOVFF 3A7,6CD
240C: MOVFF 3A6,6CC
2410: MOVFF 3A5,6CB
2414: MOVFF 3A4,6CA
2418: MOVLB 6
241A: CLRF xCF
241C: MOVLW 84
241E: MOVWF xCE
2420: CLRF xD1
2422: MOVLW 64
2424: MOVWF xD0
2426: MOVLB 0
2428: CALL 1AE2
242C: MOVFF 00,3B6
2430: MOVFF 01,3B7
2434: MOVFF 02,3B8
2438: MOVFF 03,3B9
243C: MOVFF 3AB,6CD
2440: MOVFF 3AA,6CC
2444: MOVFF 3A9,6CB
2448: MOVFF 3A8,6CA
244C: MOVLW 02
244E: MOVLB 6
2450: MOVWF xCF
2452: MOVLW 14
2454: MOVWF xCE
2456: CLRF xD1
2458: MOVLW 64
245A: MOVWF xD0
245C: MOVLB 0
245E: CALL 1AE2
2462: MOVFF 00,3BA
2466: MOVFF 01,3BB
246A: MOVFF 02,3BC
246E: MOVFF 03,3BD
2472: MOVFF 3AF,6CD
2476: MOVFF 3AE,6CC
247A: MOVFF 3AD,6CB
247E: MOVFF 3AC,6CA
2482: MOVLW 05
2484: MOVLB 6
2486: MOVWF xCF
2488: MOVLW 20
248A: MOVWF xCE
248C: CLRF xD1
248E: MOVLW 64
2490: MOVWF xD0
2492: MOVLB 0
2494: CALL 1AE2
2498: MOVFF 00,3BE
249C: MOVFF 01,3BF
24A0: MOVFF 02,3C0
24A4: MOVFF 03,3C1
24A8: MOVLW 06
24AA: MOVWF FE9
24AC: MOVFF 3B5,6D1
24B0: MOVFF 3B4,6D0
24B4: MOVFF 3B3,6CF
24B8: MOVFF 3B2,6CE
24BC: MOVLW 03
24BE: MOVLB 6
24C0: MOVWF xD2
24C2: MOVLB 0
24C4: RCALL 1DB0
24C6: MOVLW 20
24C8: MOVLB 6
24CA: MOVWF xDB
24CC: MOVLB 0
24CE: CALL 13D4
24D2: MOVLW 03
24D4: MOVWF FE9
24D6: MOVFF 3A7,6D1
24DA: MOVFF 3A6,6D0
24DE: MOVFF 3A5,6CF
24E2: MOVFF 3A4,6CE
24E6: MOVLB 6
24E8: MOVWF xD2
24EA: MOVLB 0
24EC: RCALL 1DB0
24EE: MOVLW 20
24F0: MOVLB 6
24F2: MOVWF xDB
24F4: MOVLB 0
24F6: CALL 13D4
24FA: MOVLW 03
24FC: MOVWF FE9
24FE: MOVFF 3B9,6D1
2502: MOVFF 3B8,6D0
2506: MOVFF 3B7,6CF
250A: MOVFF 3B6,6CE
250E: MOVLB 6
2510: MOVWF xD2
2512: MOVLB 0
2514: RCALL 1DB0
2516: MOVLW 20
2518: MOVLB 6
251A: MOVWF xDB
251C: MOVLB 0
251E: CALL 13D4
2522: MOVLW 03
2524: MOVWF FE9
2526: MOVFF 3AB,6D1
252A: MOVFF 3AA,6D0
252E: MOVFF 3A9,6CF
2532: MOVFF 3A8,6CE
2536: MOVLB 6
2538: MOVWF xD2
253A: MOVLB 0
253C: RCALL 1DB0
253E: MOVLW 20
2540: MOVLB 6
2542: MOVWF xDB
2544: MOVLB 0
2546: CALL 13D4
254A: MOVLW 03
254C: MOVWF FE9
254E: MOVFF 3BD,6D1
2552: MOVFF 3BC,6D0
2556: MOVFF 3BB,6CF
255A: MOVFF 3BA,6CE
255E: MOVLB 6
2560: MOVWF xD2
2562: MOVLB 0
2564: RCALL 1DB0
2566: MOVLW 20
2568: MOVLB 6
256A: MOVWF xDB
256C: MOVLB 0
256E: CALL 13D4
2572: MOVLW 03
2574: MOVWF FE9
2576: MOVFF 3AF,6D1
257A: MOVFF 3AE,6D0
257E: MOVFF 3AD,6CF
2582: MOVFF 3AC,6CE
2586: MOVLB 6
2588: MOVWF xD2
258A: MOVLB 0
258C: RCALL 1DB0
258E: MOVLW 20
2590: MOVLB 6
2592: MOVWF xDB
2594: MOVLB 0
2596: CALL 13D4
259A: MOVLW 03
259C: MOVWF FE9
259E: MOVFF 3C1,6D1
25A2: MOVFF 3C0,6D0
25A6: MOVFF 3BF,6CF
25AA: MOVFF 3BE,6CE
25AE: MOVLB 6
25B0: MOVWF xD2
25B2: MOVLB 0
25B4: CALL 1DB0
25B8: MOVLW 20
25BA: MOVLB 6
25BC: MOVWF xDB
25BE: MOVLB 0
25C0: CALL 13D4
25C4: MOVLW 0A
25C6: MOVLB 6
25C8: MOVWF xDB
25CA: MOVLB 0
25CC: CALL 13D4
25D0: MOVLW 0D
25D2: MOVLB 6
25D4: MOVWF xDB
25D6: MOVLB 0
25D8: CALL 13D4
.................... }
25DC: BRA 201A
.................... }
25DE: BRA 1FE4
.................... }
25E0: SLEEP
 
Configuration Fuses:
Word 1: CE3C IESO FCMEN HSPLL PLL5 CPUDIV4 USBDIV
Word 2: 0E39 NOBROWNOUT WDT128 NOWDT BORV20 NOPUT VREGEN
Word 3: 8700 PBADEN CCP2C1 MCLR LPT1OSC
Word 4: 00A1 STVREN NODEBUG NOLVP NOXINST ICPRT
Word 5: C00F NOPROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
Word 7: 400F NOEBTR NOEBTRB
/programy/C/PIC/mereni/inertial/main.pjt
0,0 → 1,37
[PROJECT]
Target=D:\svnKaklik\programy\C\PIC_C\mereni\inertial\main.hex
Development_Mode=
Processor_Text=PIC18F4550
ToolSuite=CCS
Processor=0x4550
[D:\svnKaklik\programy\C\PIC_C\mereni\inertial\main]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
[mru-list]
1=D:\svnKaklik\programy\C\PIC_C\mereni\inertial\main.c
[Windows]
0=0000 %S 0 0 796 451 3 0
[Opened Files]
1=main.c
2=
3=C:\Program Files\PICC\devices\18F4550.h
4=C:\Program Files\PICC\drivers\usb_cdc.h
5=C:\Program Files\PICC\drivers\pic18_usb.h
6=C:\Program Files\PICC\drivers\usb_hw_layer.h
7=C:\Program Files\PICC\drivers\usb_desc_cdc.h
8=C:\Program Files\PICC\drivers\usb.h
9=C:\Program Files\PICC\drivers\usb.c
10=C:\Program Files\PICC\drivers\pic18_usb.c
11=C:\Program Files\PICC\drivers\ctype.h
12=C:\Program Files\PICC\drivers\math.h
13=
[Target Data]
OptionString=-p +FH
FileList=D:\svnKaklik\programy\C\PIC_C\mereni\inertial\main.c
[Units]
Count=1
1=main.c (main)
/programy/C/PIC/mereni/inertial/main.h
0,0 → 1,35
#include <18F4550.h>
#device adc=10
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HSPLL //Crystal/Resonator with PLL enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES MCLR //Master Clear pin enabled
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PLL5 //Divide By 5(20MHz oscillator input)
#FUSES CPUDIV4 //System Clock by 4
#FUSES USBDIV //USB clock source comes from PLL divide by 2
#FUSES VREGEN //USB voltage regulator enabled
#FUSES ICPRT //ICPRT enabled
 
#use delay(clock=24000000)
 
/programy/C/PIC/mereni/serva/PIC16F84/main.BAK
0,0 → 1,80
#include "D:\@Kaklik\programy\PIC_C\mereni\serva\main.h"
#DEFINE servo1 PIN_A4
#DEFINE servo2 PIN_A3
#DEFINE servo3 PIN_A2
#DEFINE servo4 PIN_A0
#DEFINE SW PIN_A1
 
void main()
{
int i;
 
while(true)
{
While(input(SW))
{
output_high(servo1);
Delay_us(1500);
output_low(servo1);
output_high(servo2);
Delay_us(1500);
output_low(servo2);
output_high(servo3);
Delay_us(1500);
output_low(servo3);
output_high(servo4);
Delay_us(1500);
output_low(servo4);
Delay_ms(10);
}
While(!input(SW))
{
for(i=0; i<100; ++i)
{
output_high(servo1);
Delay_us(1000);
output_low(servo1);
output_high(servo2);
Delay_us(1000);
output_low(servo2);
output_high(servo3);
Delay_us(1000);
output_low(servo3);
output_high(servo4);
Delay_us(1000);
output_low(servo4);
Delay_ms(10);
}
for(i=0; i<100; ++i)
{
output_high(servo1);
Delay_us(2000);
output_low(servo1);
output_high(servo2);
Delay_us(2000);
output_low(servo2);
output_high(servo3);
Delay_us(2000);
output_low(servo3);
output_high(servo4);
Delay_us(2000);
output_low(servo4);
Delay_ms(10);
}
}
}
}
/programy/C/PIC/mereni/serva/PIC16F84/main.HEX
0,0 → 1,33
:1000000000308A00272800001030840000080319FF
:10001000182801308D008C018C0B0C288D0B0B28BF
:100020004A308C008C0B122800000000800B09283D
:10003000003411308400FC308005800C800C0008F6
:100040000319262824280000800B2328003484016B
:100050001F308305831685148312851C7B28831625
:100060000512831205160130900004200230900022
:10007000EC3091001920900B38288316051283125A
:100080000512831685118312851501309000042016
:1000900002309000EC3091001920900B4A28831612
:1000A0008511831285118316051183120515013000
:1000B0009000042002309000EC3091001920900B49
:1000C0005C2883160511831205118316051083120F
:1000D000051401309000042002309000EC309100B3
:1000E0001920900B6E2883160510831205100A3014
:1000F000900004202A288316851483128518ED2881
:100100008F010F08633C031CB62883160512831267
:100110000516013090000420831605128312051283
:1001200083168511831285150130900004208316F3
:10013000851183128511831605118312051501306F
:1001400090000420831605118312051183160510F3
:1001500083120514013090000420831605108312C9
:1001600005100A30900004208F0A81288F010F08A3
:10017000633C031CEC28831605128312051602301B
:100180009000042083160512831205128316851130
:100190008312851502309000042083168511831286
:1001A0008511831605118312051502309000042075
:1001B0008316051183120511831605108312051489
:1001C00002309000042083160510831205100A30B7
:0E01D000900004208F0AB7287B282A2863009D
:02400E00F93F78
:00000001FF
;PIC16F84
/programy/C/PIC/mereni/serva/PIC16F84/main.LST
0,0 → 1,340
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\mereni\serva\main.LST
 
ROM used: 239 (23%)
Largest free fragment is 785
RAM used: 4 (6%) at main() level
5 (7%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 027
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\mereni\serva\main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 10
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: RETLW 00
0019: MOVLW 11
001A: MOVWF 04
001B: MOVLW FC
001C: ANDWF 00,F
001D: RRF 00,F
001E: RRF 00,F
001F: MOVF 00,W
0020: BTFSC 03.2
0021: GOTO 026
0022: GOTO 024
0023: NOP
0024: DECFSZ 00,F
0025: GOTO 023
0026: RETLW 00
.................... #fuses XT,NOWDT
....................
....................
.................... #DEFINE servo1 PIN_A4
.................... #DEFINE servo2 PIN_A3
.................... #DEFINE servo3 PIN_A2
.................... #DEFINE servo4 PIN_A0
.................... #DEFINE SW PIN_A1
....................
.................... void main()
.................... {
.................... int i;
0027: CLRF 04
0028: MOVLW 1F
0029: ANDWF 03,F
....................
.................... while(true)
.................... {
.................... While(input(SW))
002A: BSF 03.5
002B: BSF 05.1
002C: BCF 03.5
002D: BTFSS 05.1
002E: GOTO 07B
.................... {
.................... output_high(servo1);
002F: BSF 03.5
0030: BCF 05.4
0031: BCF 03.5
0032: BSF 05.4
.................... Delay_us(1500);
0033: MOVLW 01
0034: MOVWF 10
0035: CALL 004
0036: MOVLW 02
0037: MOVWF 10
0038: MOVLW EC
0039: MOVWF 11
003A: CALL 019
003B: DECFSZ 10,F
003C: GOTO 038
.................... output_low(servo1);
003D: BSF 03.5
003E: BCF 05.4
003F: BCF 03.5
0040: BCF 05.4
....................
.................... output_high(servo2);
0041: BSF 03.5
0042: BCF 05.3
0043: BCF 03.5
0044: BSF 05.3
.................... Delay_us(1500);
0045: MOVLW 01
0046: MOVWF 10
0047: CALL 004
0048: MOVLW 02
0049: MOVWF 10
004A: MOVLW EC
004B: MOVWF 11
004C: CALL 019
004D: DECFSZ 10,F
004E: GOTO 04A
.................... output_low(servo2);
004F: BSF 03.5
0050: BCF 05.3
0051: BCF 03.5
0052: BCF 05.3
....................
.................... output_high(servo3);
0053: BSF 03.5
0054: BCF 05.2
0055: BCF 03.5
0056: BSF 05.2
.................... Delay_us(1500);
0057: MOVLW 01
0058: MOVWF 10
0059: CALL 004
005A: MOVLW 02
005B: MOVWF 10
005C: MOVLW EC
005D: MOVWF 11
005E: CALL 019
005F: DECFSZ 10,F
0060: GOTO 05C
.................... output_low(servo3);
0061: BSF 03.5
0062: BCF 05.2
0063: BCF 03.5
0064: BCF 05.2
....................
.................... output_high(servo4);
0065: BSF 03.5
0066: BCF 05.0
0067: BCF 03.5
0068: BSF 05.0
.................... Delay_us(1500);
0069: MOVLW 01
006A: MOVWF 10
006B: CALL 004
006C: MOVLW 02
006D: MOVWF 10
006E: MOVLW EC
006F: MOVWF 11
0070: CALL 019
0071: DECFSZ 10,F
0072: GOTO 06E
.................... output_low(servo4);
0073: BSF 03.5
0074: BCF 05.0
0075: BCF 03.5
0076: BCF 05.0
....................
.................... Delay_ms(10);
0077: MOVLW 0A
0078: MOVWF 10
0079: CALL 004
.................... }
007A: GOTO 02A
....................
.................... While(!input(SW))
007B: BSF 03.5
007C: BSF 05.1
007D: BCF 03.5
007E: BTFSC 05.1
007F: GOTO 0ED
.................... {
.................... for(i=0; i<100; ++i)
0080: CLRF 0F
0081: MOVF 0F,W
0082: SUBLW 63
0083: BTFSS 03.0
0084: GOTO 0B6
.................... {
.................... output_high(servo1);
0085: BSF 03.5
0086: BCF 05.4
0087: BCF 03.5
0088: BSF 05.4
.................... Delay_us(1000);
0089: MOVLW 01
008A: MOVWF 10
008B: CALL 004
.................... output_low(servo1);
008C: BSF 03.5
008D: BCF 05.4
008E: BCF 03.5
008F: BCF 05.4
....................
.................... output_high(servo2);
0090: BSF 03.5
0091: BCF 05.3
0092: BCF 03.5
0093: BSF 05.3
.................... Delay_us(1000);
0094: MOVLW 01
0095: MOVWF 10
0096: CALL 004
.................... output_low(servo2);
0097: BSF 03.5
0098: BCF 05.3
0099: BCF 03.5
009A: BCF 05.3
....................
.................... output_high(servo3);
009B: BSF 03.5
009C: BCF 05.2
009D: BCF 03.5
009E: BSF 05.2
.................... Delay_us(1000);
009F: MOVLW 01
00A0: MOVWF 10
00A1: CALL 004
.................... output_low(servo3);
00A2: BSF 03.5
00A3: BCF 05.2
00A4: BCF 03.5
00A5: BCF 05.2
....................
.................... output_high(servo4);
00A6: BSF 03.5
00A7: BCF 05.0
00A8: BCF 03.5
00A9: BSF 05.0
.................... Delay_us(1000);
00AA: MOVLW 01
00AB: MOVWF 10
00AC: CALL 004
.................... output_low(servo4);
00AD: BSF 03.5
00AE: BCF 05.0
00AF: BCF 03.5
00B0: BCF 05.0
....................
.................... Delay_ms(10);
00B1: MOVLW 0A
00B2: MOVWF 10
00B3: CALL 004
.................... }
00B4: INCF 0F,F
00B5: GOTO 081
....................
.................... for(i=0; i<100; ++i)
00B6: CLRF 0F
00B7: MOVF 0F,W
00B8: SUBLW 63
00B9: BTFSS 03.0
00BA: GOTO 0EC
.................... {
.................... output_high(servo1);
00BB: BSF 03.5
00BC: BCF 05.4
00BD: BCF 03.5
00BE: BSF 05.4
.................... Delay_us(2000);
00BF: MOVLW 02
00C0: MOVWF 10
00C1: CALL 004
.................... output_low(servo1);
00C2: BSF 03.5
00C3: BCF 05.4
00C4: BCF 03.5
00C5: BCF 05.4
....................
.................... output_high(servo2);
00C6: BSF 03.5
00C7: BCF 05.3
00C8: BCF 03.5
00C9: BSF 05.3
.................... Delay_us(2000);
00CA: MOVLW 02
00CB: MOVWF 10
00CC: CALL 004
.................... output_low(servo2);
00CD: BSF 03.5
00CE: BCF 05.3
00CF: BCF 03.5
00D0: BCF 05.3
....................
.................... output_high(servo3);
00D1: BSF 03.5
00D2: BCF 05.2
00D3: BCF 03.5
00D4: BSF 05.2
.................... Delay_us(2000);
00D5: MOVLW 02
00D6: MOVWF 10
00D7: CALL 004
.................... output_low(servo3);
00D8: BSF 03.5
00D9: BCF 05.2
00DA: BCF 03.5
00DB: BCF 05.2
....................
.................... output_high(servo4);
00DC: BSF 03.5
00DD: BCF 05.0
00DE: BCF 03.5
00DF: BSF 05.0
.................... Delay_us(2000);
00E0: MOVLW 02
00E1: MOVWF 10
00E2: CALL 004
.................... output_low(servo4);
00E3: BSF 03.5
00E4: BCF 05.0
00E5: BCF 03.5
00E6: BCF 05.0
....................
.................... Delay_ms(10);
00E7: MOVLW 0A
00E8: MOVWF 10
00E9: CALL 004
.................... }
00EA: INCF 0F,F
00EB: GOTO 0B7
.................... }
00EC: GOTO 07B
.................... }
00ED: GOTO 02A
.................... }
....................
00EE: SLEEP
/programy/C/PIC/mereni/serva/PIC16F84/main.PJT
0,0 → 1,35
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\serva\PIC16F84\main.c
2=
/programy/C/PIC/mereni/serva/PIC16F84/main.SYM
0,0 → 1,16
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F main.i
010 delay_ms.P1
010 main.@SCRATCH
011 delay_us.P1
 
0004 delay_ms
0019 delay_us
0027 main
 
Project Files:
d:\@kaklik\programy\pic_c\mereni\serva\main.c
D:\@Kaklik\programy\PIC_C\mereni\serva\main.h
C:\PROGRAM FILES\PICC\devices\16F84.h
/programy/C/PIC/mereni/serva/PIC16F84/main.c
0,0 → 1,81
#include "D:\@Kaklik\programy\PIC_C\mereni\serva\main.h"
#DEFINE servo1 PIN_A4
#DEFINE servo2 PIN_A3
#DEFINE servo3 PIN_A2
#DEFINE servo4 PIN_A0
#DEFINE SW PIN_A1
 
void main()
{
int i;
 
 
while(true)
{
While(input(SW))
{
output_high(servo1);
Delay_us(1500);
output_low(servo1);
output_high(servo2);
Delay_us(1500);
output_low(servo2);
output_high(servo3);
Delay_us(1500);
output_low(servo3);
output_high(servo4);
Delay_us(1500);
output_low(servo4);
Delay_ms(10);
}
While(!input(SW))
{
for(i=0; i<100; ++i)
{
output_high(servo1);
Delay_us(1000);
output_low(servo1);
output_high(servo2);
Delay_us(1000);
output_low(servo2);
output_high(servo3);
Delay_us(1000);
output_low(servo3);
output_high(servo4);
Delay_us(1000);
output_low(servo4);
Delay_ms(10);
}
for(i=0; i<100; ++i)
{
output_high(servo1);
Delay_us(2000);
output_low(servo1);
output_high(servo2);
Delay_us(2000);
output_low(servo2);
output_high(servo3);
Delay_us(2000);
output_low(servo3);
output_high(servo4);
Delay_us(2000);
output_low(servo4);
Delay_ms(10);
}
}
}
}
/programy/C/PIC/mereni/serva/PIC16F84/main.cod
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
/programy/C/PIC/mereni/serva/PIC16F84/main.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/serva/PIC16F84/main.h
0,0 → 1,4
#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,NOWDT
 
/programy/C/PIC/mereni/serva/PIC16F84/main.sta
0,0 → 1,29
 
ROM used: 239 (23%)
785 (77%) including unused fragments
 
1 Average locations per line
5 Average locations per statement
 
RAM used: 4 (6%) at main() level
5 (7%) worst case
 
Lines Stmts % Files
----- ----- --- -----
81 49 100 d:\@kaklik\programy\pic_c\mereni\serva\main.c
5 0 0 D:\@Kaklik\programy\PIC_C\mereni\serva\main.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h
----- -----
394 98 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 9 1 delay_ms
0 14 6 1 delay_us
0 200 84 2 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 235 785
 
/programy/C/PIC/mereni/serva/PIC16F84/main.tre
0,0 → 1,22
ÀÄmain
ÀÄmain 0/200 Ram=2
ÃÄ??0??
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_us 0/14 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_us 0/14 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_us 0/14 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_us 0/14 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÃÄdelay_ms 0/21 Ram=1
ÀÄdelay_ms 0/21 Ram=1
/programy/C/PIC/mereni/serva/PIC16F84/prg.bat
0,0 → 1,8
:start
call picpgr stop
call picpgr erase pic16f84
call picpgr program main.hex hex pic16f84
call picpgr run
pause
call picpgr stop
rem goto start
/programy/C/PIC/mereni/serva/PIC16F84/vssver.scc
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
/programy/C/PIC/mereni/tester_serv/blikac.BAK
0,0 → 1,40
#include "blikac.h"
#DEFINE SERVO_X PIN_A2 // piny na ktere jsou pripojena serva
#DEFINE SERVO_Y PIN_B0
#DEFINE TL1 PIN_B1
 
void main()
{
int i;
while (true)
{
while(input(TL1))
{
for(i=0;i<=100;i++)
{
output_high(servo_y);
output_high(servo_x);
delay_us(1000);
output_low(servo_y);
output_low(servo_x);
delay_ms(20);
}
 
for(i=0;i<=100;i++)
{
output_high(servo_y);
output_high(servo_x);
delay_us(2000);
output_low(servo_y);
output_low(servo_x);
delay_ms(20);
}
}
output_high(servo_y);
output_high(servo_x);
delay_us(1500);
output_low(servo_y);
output_low(servo_x);
delay_ms(20);
}
}
/programy/C/PIC/mereni/tester_serv/blikac.HEX
0,0 → 1,23
:020000040000FA
:1000000000308A002B2800001330840000080319F8
:10001000172801308D008C018C0B0C288D0B0B28C0
:100020004A308C008C0B12281528800B09280034CC
:1000300012309402031C2A2814308400FC308005FE
:100040000310800C800C000803192A2828280000BF
:10005000800B27287E2884011F3083058316861491
:100060008312861C6E2892011208643C031C5028DF
:1000700083160610831206148316051183120515C4
:100080000130930004208316061083120610831695
:10009000051183120511143093000420920A3428AC
:1000A00092011208643C031C6D288316061083120B
:1000B00006148316051183120515023093000420DF
:1000C000831606108312061083160511831205117C
:1000D000143093000420920A51282E28831606100B
:1000E000831206148316051183120515013093003F
:1000F000042002309300F73094001828930B7B28DB
:10010000831606108312061083160511831205113B
:0A0110001430930004202E28630031
:02400E00F93F78
:00000001FF
;PIC16C84
;CRC=26BE CREATED="23-I-10 18:21"
/programy/C/PIC/mereni/tester_serv/blikac.LST
0,0 → 1,204
CCS PCM C Compiler, Version 4.090, 47914 23-I-10 18:21
 
Filename: D:\svnKaklik\programy\C\PIC_C\mereni\tester serv\blikac.lst
 
ROM used: 141 words (14%)
Largest free fragment is 883
RAM used: 7 (19%) at main() level
8 (22%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 02B
0003: NOP
.................... #include "blikac.h"
.................... #include <16C84.h>
.................... //////// Standard Header file for the PIC16C84 device ////////////////
.................... #device PIC16C84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 13
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 017
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: GOTO 015
0015: DECFSZ 00,F
0016: GOTO 009
0017: RETLW 00
0018: MOVLW 12
0019: SUBWF 14,F
001A: BTFSS 03.0
001B: GOTO 02A
001C: MOVLW 14
001D: MOVWF 04
001E: MOVLW FC
001F: ANDWF 00,F
0020: BCF 03.0
0021: RRF 00,F
0022: RRF 00,F
0023: MOVF 00,W
0024: BTFSC 03.2
0025: GOTO 02A
0026: GOTO 028
0027: NOP
0028: DECFSZ 00,F
0029: GOTO 027
002A: GOTO 07E (RETURN)
.................... #fuses XT,PUT,NOWDT
....................
....................
.................... #DEFINE SERVO_X PIN_A2 // piny na ktere jsou pripojena serva
.................... #DEFINE SERVO_Y PIN_B0
.................... #DEFINE TL1 PIN_B1
....................
.................... void main()
.................... {
002B: CLRF 04
002C: MOVLW 1F
002D: ANDWF 03,F
.................... int i;
.................... while (true)
.................... {
.................... while(input(TL1))
.................... {
002E: BSF 03.5
002F: BSF 06.1
0030: BCF 03.5
0031: BTFSS 06.1
0032: GOTO 06E
.................... for(i=0;i<=100;i++)
0033: CLRF 12
0034: MOVF 12,W
0035: SUBLW 64
0036: BTFSS 03.0
0037: GOTO 050
.................... {
.................... output_high(servo_y);
0038: BSF 03.5
0039: BCF 06.0
003A: BCF 03.5
003B: BSF 06.0
.................... output_high(servo_x);
003C: BSF 03.5
003D: BCF 05.2
003E: BCF 03.5
003F: BSF 05.2
.................... delay_us(1000);
0040: MOVLW 01
0041: MOVWF 13
0042: CALL 004
.................... output_low(servo_y);
0043: BSF 03.5
0044: BCF 06.0
0045: BCF 03.5
0046: BCF 06.0
.................... output_low(servo_x);
0047: BSF 03.5
0048: BCF 05.2
0049: BCF 03.5
004A: BCF 05.2
.................... delay_ms(20);
004B: MOVLW 14
004C: MOVWF 13
004D: CALL 004
.................... }
004E: INCF 12,F
004F: GOTO 034
....................
.................... for(i=0;i<=100;i++)
0050: CLRF 12
0051: MOVF 12,W
0052: SUBLW 64
0053: BTFSS 03.0
0054: GOTO 06D
.................... {
.................... output_high(servo_y);
0055: BSF 03.5
0056: BCF 06.0
0057: BCF 03.5
0058: BSF 06.0
.................... output_high(servo_x);
0059: BSF 03.5
005A: BCF 05.2
005B: BCF 03.5
005C: BSF 05.2
.................... delay_us(2000);
005D: MOVLW 02
005E: MOVWF 13
005F: CALL 004
.................... output_low(servo_y);
0060: BSF 03.5
0061: BCF 06.0
0062: BCF 03.5
0063: BCF 06.0
.................... output_low(servo_x);
0064: BSF 03.5
0065: BCF 05.2
0066: BCF 03.5
0067: BCF 05.2
.................... delay_ms(20);
0068: MOVLW 14
0069: MOVWF 13
006A: CALL 004
.................... }
006B: INCF 12,F
006C: GOTO 051
.................... }
006D: GOTO 02E
.................... output_high(servo_y);
006E: BSF 03.5
006F: BCF 06.0
0070: BCF 03.5
0071: BSF 06.0
.................... output_high(servo_x);
0072: BSF 03.5
0073: BCF 05.2
0074: BCF 03.5
0075: BSF 05.2
.................... delay_us(1500);
0076: MOVLW 01
0077: MOVWF 13
0078: CALL 004
0079: MOVLW 02
007A: MOVWF 13
007B: MOVLW F7
007C: MOVWF 14
007D: GOTO 018
007E: DECFSZ 13,F
007F: GOTO 07B
.................... output_low(servo_y);
0080: BSF 03.5
0081: BCF 06.0
0082: BCF 03.5
0083: BCF 06.0
.................... output_low(servo_x);
0084: BSF 03.5
0085: BCF 05.2
0086: BCF 03.5
0087: BCF 05.2
.................... delay_ms(20);
0088: MOVLW 14
0089: MOVWF 13
008A: CALL 004
.................... }
008B: GOTO 02E
.................... }
008C: SLEEP
 
Configuration Fuses:
Word 1: 3FF9 XT NOWDT PUT NOPROTECT
/programy/C/PIC/mereni/tester_serv/blikac.PJT
0,0 → 1,40
[PROJECT]
Target=blikac.HEX
Development_Mode=
Processor=0x6C84
ToolSuite=CCS
Processor_Text=PIC16C84
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=D:\svnKaklik\programy\C\PIC_C\mereni\tester serv\blikac.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[blikac.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=blikac.c
 
[Windows]
0=0000 blikac.c 0 0 796 451 3 0
 
[Opened Files]
1=blikac.c
2=C:\PROGRAM FILES\PICC\devices\16C84.h
3=
[Units]
Count=1
1=blikac.c (main)
/programy/C/PIC/mereni/tester_serv/blikac.SYM
0,0 → 1,50
004-005 @READ_PROGRAM_MEMORY8.P1
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00E @SCRATCH
00F @SCRATCH
010 @SCRATCH
012 main.i
013 @delay_ms1.P1
013 main.@SCRATCH1
014 @delay_us1.P1
10D-10E @READ_PROGRAM_MEMORY8.P1
 
ROM Allocation:
0004 @delay_ms1
0018 @delay_us1
002B main
002B @cinit
 
 
User Memory space:
 
Project Directory:
D:\svnKaklik\programy\C\PIC_C\mereni\tester serv\
 
Project Files:
blikac.c
blikac.h
C:\PROGRAM FILES\PICC\devices\16C84.h
 
Units:
D:\svnKaklik\programy\C\PIC_C\mereni\tester serv\blikac.c (main)
 
Compiler Settings:
Processor: PIC16C84
Pointer Size: 8
Opt Level: 9
Short,Int,Long: UNSIGNED: 1,8,16
Float,Double: 32,32
 
Output Files:
Errors: blikac.err
Ext Symbols: blikac.esym
INHX8: blikac.hex
Symbols: blikac.sym
List: blikac.lst
Debug/COFF: blikac.cof
Project: blikac.PJT
Call Tree: blikac.tre
Statistics: blikac.sta
/programy/C/PIC/mereni/tester_serv/blikac.c
0,0 → 1,40
#include "blikac.h"
#DEFINE SERVO_X PIN_A2 // piny na ktere jsou pripojena serva
#DEFINE SERVO_Y PIN_B0
#DEFINE TL1 PIN_B1
 
void main()
{
int i;
while (true)
{
while(input(TL1))
{
for(i=0;i<=100;i++)
{
output_high(servo_y);
output_high(servo_x);
delay_us(1000);
output_low(servo_y);
output_low(servo_x);
delay_ms(20);
}
 
for(i=0;i<=100;i++)
{
output_high(servo_y);
output_high(servo_x);
delay_us(2000);
output_low(servo_y);
output_low(servo_x);
delay_ms(20);
}
}
output_high(servo_y);
output_high(servo_x);
delay_us(1500);
output_low(servo_y);
output_low(servo_x);
delay_ms(20);
}
}
/programy/C/PIC/mereni/tester_serv/blikac.err
0,0 → 1,2
Memory usage: ROM=14% RAM=19% - 22%
0 Errors, 0 Warnings.
/programy/C/PIC/mereni/tester_serv/blikac.sta
0,0 → 1,45
 
ROM used: 141 (14%)
141 (14%) including unused fragments
 
1 Average locations per line
5 Average locations per statement
 
RAM used: 7 (19%) at main() level
8 (22%) worst case
 
Stack used: 1 worst case (out of 8 total available)
 
Lines Stmts % Files
----- ----- --- -----
41 26 100 blikac.c
5 0 0 blikac.h
115 0 0 C:\PROGRAM FILES\PICC\devices\16C84.h
----- -----
161 26 Total
 
Page ROM % RAM Vol Diff Functions:
---- --- --- --- --- ---- ----------
0 20 14 1 @delay_ms1
0 19 13 1 @delay_us1
0 98 70 2 670 3.8 main
 
Program metrics:
Functions 1
Statements 26
Comments 37
Volume (V) 675
Difficilty (D) 3.7
Effort to implement (E) 2505
Time to implement (T) 2 minutes
Est Delivered Bugs (B) 0
Cyclomatic Complexity 2
Maintainability (MI) 84
 
Segment Used Free
----------- ---- ----
00000-00003 4 0
00004-003FF 137 883
 
 
 
/programy/C/PIC/mereni/tester_serv/blikac.tre
0,0 → 1,10
ÀÄblikac
ÀÄmain 0/98 Ram=2
ÃÄ??0??
ÃÄ@delay_ms1 0/20 Ram=1
ÃÄ@delay_ms1 0/20 Ram=1
ÃÄ@delay_ms1 0/20 Ram=1
ÃÄ@delay_ms1 0/20 Ram=1
ÃÄ@delay_ms1 0/20 Ram=1
ÃÄ@delay_us1 0/19 Ram=1
ÀÄ@delay_ms1 0/20 Ram=1
/programy/C/PIC/mereni/tester_serv/blikac.cod
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
/programy/C/PIC/mereni/tester_serv/blikac.h
0,0 → 1,4
#include <16C84.h>
#use delay(clock=4000000)
#fuses XT,PUT,NOWDT
 
/programy/C/PIC/mereni/tester_serv/vssver.scc
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
/programy/C/PIC/mereni/teplomer/1wire.c
0,0 → 1,43
#define ONE_WIRE_PIN PIN_A3 // pro pristup k cidlu jsem zvolil
 
void onewire_reset()
{
output_low(ONE_WIRE_PIN);
delay_us(240);
output_float(ONE_WIRE_PIN);
delay_us(150);
output_float(ONE_WIRE_PIN);
}
 
void onewire_write(int data)
{
int count;
 
for (count=0; count<8; ++count)
{
output_low(ONE_WIRE_PIN);
delay_us( 2 );
output_bit(ONE_WIRE_PIN, shift_right(&data,1,1));
 
delay_us( 40 );
output_float(ONE_WIRE_PIN);
delay_us( 2 );
}
}
 
int onewire_read()
{
int count, data;
 
for (count=0; count<8; ++count)
{
output_low(ONE_WIRE_PIN);
delay_us( 2 );
output_float(ONE_WIRE_PIN);
delay_us( 8 );
shift_right(&data,1,input(ONE_WIRE_PIN));
delay_us(5);
}
 
return( data );
}
/programy/C/PIC/mereni/teplomer/main.c
0,0 → 1,84
#include "main.h"
#define LED_K1 PIN_A2 // anody segmentovek
#define LED_K2 PIN_A1
#include "1wire.c"
 
 
void main()
{
//long duty; // strida PWM
int znak1; // hodnota jednotek
int znak2; // hodnota desitek
int znak; // zobrazovany znak
int i, n, temp; // i pro for
int8 temp1, temp2;
signed int16 temp3;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(FALSE);
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(TRUE)
{
temp3 = make16(temp2, temp1);
temp=(int) (temp3/16);
znak2=(int) (temp/10); //vydelit deseti a zaokrouhlit dolu = desitky
znak1=temp-znak2*10; //jednotky rozdil teploty a desitek
for (n=0;n<=2;n++)
{
for (i=0;i<=2;i++) { //cyklus zobrazeni udaje
if (i==1) {
output_low(LED_K2); //dva bloky pro sepnuti aktivniho segmentu na 1
if (n==0){
onewire_reset();
onewire_write(0xCC);
onewire_write(0x44);
}
output_high(LED_K1);
znak=znak1;
 
}
if (i==2) {
output_low(LED_K1);
if (n==0){
onewire_reset();
onewire_write(0xCC);
onewire_write(0xBE);
temp1 = onewire_read();
temp2 = onewire_read();
}
output_high(LED_K2);
znak=znak2;
}
if (temp>=85)
{
output_high(LED_K1);
output_high(LED_K2);
output_b(0b00001101);
}
else
{
if (znak==1) output_b(0b11110010); //blok if pro rozeznani zobrazeneho znaku
if (znak==2) output_b(0b01001000);
if (znak==3) output_b(0b01100000);
if (znak==4) output_b(0b00110010);
if (znak==5) output_b(0b00100100);
if (znak==6) output_b(0b00000100);
if (znak==7) output_b(0b11110000);
if (znak==8) output_b(0b00000000);
if (znak==9) output_b(0b00100000);
if (znak==0) output_b(0b10000000);
}
Delay_ms(6);
}
}
// duty=104+(2,31*temp); // .000416/(16*(1/4000000)) ....PWM presne podle helpu
// set_pwm1_duty(duty);
}
}
/programy/C/PIC/mereni/teplomer/main.h
0,0 → 1,6
#include <16F88.h>
#device adc=8
#fuses NOWDT,INTRC_IO, NOPUT, NOMCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, NOFCMEN, NOIESO
#use delay(clock=4000000)
 
 
/programy/C/PIC/mereni/teplomer/main.hex
0,0 → 1,76
:1000000000308A006D290000831685118312851146
:10001000A630F700F70B0A28000083168515A630D6
:10002000F700F70B11280000851583120034B30187
:100030003308073C031C372883168511831285116A
:10004000000000000314B20C031828288511292889
:100050008515831685111330F700F70B2D28000046
:1000600000008515000000008312B30A1828003430
:10007000B2013208073C031C5A28831685118312EB
:10008000851100000000831685150230F700F70B7C
:100090004728000085158312851950280310512820
:1000A0000314B30C2730F700F70B542800000000AE
:1000B000B20A39283308F80000343308350680398D
:1000C000B700B31F6828B209B309B20A0319B30A0B
:1000D000B51F6F28B409B509B40A0319B50AF801A8
:1000E000F901F701FA013508031D792834080319CD
:1000F00093281030B6000310B20DB30DF70DFA0DB2
:1001000035087A02031D862834087702031C8F28DD
:100110003408F702031CFA033508FA020314F80D39
:10012000F90DB60B7B280000B71F9B28F809F909C9
:10013000F80A0319F90A8A11E4288E30F700330807
:10014000F8003208F900FA01F808031DB12879080F
:10015000F800F9010830F702F808031DB128F7018B
:10016000B9280310F81BB828F90DF80DF703B128CA
:10017000F81300008A11E828A9010420CC30B2004D
:1001800017204430B2001720A908031DCB283820BF
:100190007808A900C4280420CC30B2001720BE3053
:1001A000B200172038207808AA0038207808AB0061
:1001B0002B08AD002A08AC002D08B3002C08B200B3
:1001C000B5011030B4005D287808B301B2009D2855
:1001D0007A08B1007908B0007808AF007708AE005F
:1001E0002E08F7002F08F8003008F9003108FA004F
:1001F0008A11A7298E30F7002908F7022A08F9008A
:100200002B08F800F917F708031911290310F9084A
:10021000031D0D29F80803191129F90CF80CF70B27
:100220000629AA1F1829F809F909F80A0319F90A71
:1002300000008A11B0292A08F8012902031823298D
:100240002908F7002F29F7010830AB00A90DF70D99
:100250002A0877020318F700F80DAB0B26298A113C
:10026000BF29F701F801290803102A18F707F70C2E
:10027000F80CAA18F707F70CF80C2A19F707F70C6F
:10028000F80CAA19F707F70CF80C2A1AF707F70C5D
:10029000F80CAA1AF707F70CF80C2A1BF707F70C4B
:1002A000F80CAA1BF707F70CF80C8A11C62929309D
:1002B0008400000803196B290130F800F701F70BDF
:1002C0005F29F80B5E294A30F700F70B652900001B
:1002D0000000800B5C298A11412A84011F308305AC
:1002E000603083168F001F129F121B0880399B00FD
:1002F00007309C001F129F121B0880399B0083123D
:100300001F109412831606118614061200308312F1
:100310009400831694000108C739083881008312BD
:1003200090010030F80092000030831692000730F0
:100330009C0005080330F700F70B9C291C0883126A
:100340000D1383169D018F010F088312BC287A08B4
:10035000AC007908AB007808AA007708A900FA2851
:100360007808A3002308093C031CBA292308A40029
:10037000A501C9292308A9000A30AA001B29780869
:10038000A5002508A9000A30AA003129780823020F
:10039000A400A7012708013C031C432AA708031D4A
:1003A000DB298316851083128510831605118312AD
:1003B00005152408A600270BE729831605118312CB
:1003C000051183168510831285142508A600260BB7
:1003D000EE2983168601F330831286002608023C3C
:1003E000031DF729831686014930831286002608EB
:1003F000033C031D002A83168601613083128600A8
:100400002608043C031D092A831686013330831213
:1004100086002608053C031D122A83168601253016
:10042000831286002608063C031D1B2A83168601BC
:100430000530831286002608073C031D242A8316F4
:100440008601F130831286002608083C031D2D2A00
:10045000831686010130831286002608093C031D9D
:10046000362A83168601213083128600A608031DD2
:100470003E2A831686018130831286000A30A90045
:0C0480005729A70ACA298316A529630082
:04400E00F83FFF3F39
:00000001FF
;PIC16F88
/programy/C/PIC/mereni/teplomer/main.sta
0,0 → 1,40
 
ROM used: 582 (14%)
582 (14%) including unused fragments
 
1 Average locations per line
7 Average locations per statement
 
RAM used: 13 (7%) at main() level
28 (16%) worst case
 
Lines Stmts % Files
----- ----- --- -----
88 52 60 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.c
19 0 0 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.h
279 0 0 C:\Program Files\PICC\devices\16F88.h
49 22 16 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\1wire.c
29 13 8 D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\ds1820.c
----- -----
928 174 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 22 4 1 @delay_ms1
0 19 3 0 onewire_reset
0 33 6 2 onewire_write
0 37 6 2 onewire_read
0 62 11 9 ds1820_read
0 64 11 6 @DIVS1616
0 31 5 2 @ITOF
0 217 37 8 main
0 33 6 4 @SFTOI
0 22 4 3 @DIV88
0 38 7 2 @MUL88
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 578 1466
00800-00FFF 0 2048
 
/programy/C/PIC/mereni/teplomer/main.sym
0,0 → 1,78
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
021-022 main.duty
023 main.temp
024 main.znak1
025 main.znak2
026 main.znak
027 main.i
028 main.n
029 ds1820_read.busy
029 @DIV88.P1
029 @delay_ms1.P2
029 @MUL88.P3
029-02C @SFTOI.P4
02A @DIV88.P1
02A ds1820_read.temp1
02A @MUL88.P1
02B ds1820_read.temp2
02B @DIV88.@SCRATCH
02C-02D ds1820_read.temp3
02E-031 ds1820_read.result
032 onewire_read.count
032-033 @ITOF.P1
032-033 @DIVS1616.P2
032 onewire_write.data
033 onewire_write.count
033 onewire_read.data
034-035 @DIVS1616.P1
036 @DIVS1616.@SCRATCH
037 @DIVS1616.@SCRATCH
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
09C.6 C1OUT
09C.7 C2OUT
 
0157 @delay_ms1
0004 onewire_reset
0017 onewire_write
0038 onewire_read
00BC ds1820_read
005D @DIVS1616
009D @ITOF
016D main
00FA @SFTOI
011B @DIV88
0131 @MUL88
016D @cinit
 
Project Files:
D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.c
D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.h
C:\Program Files\PICC\devices\16F88.h
D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\1wire.c
D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\ds1820.c
 
Units:
D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.c (main)
 
Compiler Settings:
Processor: PIC16F88
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.err
INHX8: D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.hex
Symbols: D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.sym
List: D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.lst
Debug/COFF: D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.cof
Call Tree: D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.tre
Statistics: D:\KAKLIK\projekty\programy\C\PIC_C\mereni\teplomer\main.sta
/programy/C/PIC/mereni/teplomer/main.tre
0,0 → 1,19
ÀÄmain
ÀÄmain 0/217 Ram=8
ÃÄ??0??
ÃÄds1820_read 0/62 Ram=9
³ ÃÄonewire_reset 0/19 Ram=0
³ ÃÄonewire_write 0/33 Ram=2
³ ÃÄonewire_write 0/33 Ram=2
³ ÃÄonewire_read 0/37 Ram=2
³ ÃÄonewire_reset 0/19 Ram=0
³ ÃÄonewire_write 0/33 Ram=2
³ ÃÄonewire_write 0/33 Ram=2
³ ÃÄonewire_read 0/37 Ram=2
³ ÃÄonewire_read 0/37 Ram=2
³ ÃÄ@DIVS1616 0/64 Ram=6
³ ÀÄ@ITOF 0/31 Ram=2
ÃÄ@SFTOI 0/33 Ram=4
ÃÄ@DIV88 0/22 Ram=3
ÃÄ@MUL88 0/38 Ram=2
ÀÄ@delay_ms1 0/22 Ram=1
/programy/C/PIC/mereni/teplomer/ds1820.c
0,0 → 1,28
float ds1820_read()
{
int8 busy=0, temp1, temp2;
signed int16 temp3;
float result;
 
onewire_reset();
onewire_write(0xCC);
onewire_write(0x44);
 
while (busy == 0)
busy = onewire_read();
 
onewire_reset();
onewire_write(0xCC);
onewire_write(0xBE);
temp1 = onewire_read();
temp2 = onewire_read();
temp3 = make16(temp2, temp1);
 
result = (int) (temp3/16); //calculation pro DS18B20 with 0.1 deg C
 
 
return(result);
 
}
 
/programy/C/PIC/mereni/teplomer/main.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/mereni/teplomer/mainhcg.BAK
0,0 → 1,82
#include "main.h"
 
 
#define LED_K1 PIN_A2 // anody segmentovek
#define LED_K2 PIN_A1
//#define LED_D1 PIN_A1 // katody segmentovek ///ted uz nepotreba
//#define LED_D2 PIN_A2
//#define LED_D3 PIN_A3
//#define LED_D4 PIN_A4
//#define LED_D5 PIN_A5
//#define LED_D6 PIN_A6
//#define LED_D7 PIN_A7
 
#include "1wire.c"
#include "ds1820.c"
 
void main()
{
float temperature; // teplota z ds1820.c
long duty; // strida PWM
int temp; // zaokrouhlena teplota
int znak1; // hodnota jednotek
int znak2; // hodnota desitek
int znak; // zobrazovany znak
int i; // i pro for
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(FALSE);
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);
port_b_pullups(TRUE);
 
 
while(TRUE)
{
temperature = ds1820_read();
temp = (int) temperature;
 
if (temp<10) { //pro teploty 0-10°C
znak1=temp;
znak2=0;
}
else {
znak2=(int) (temp/10); //vydelit deseti a zaokrouhlit dolu = desitky
znak1=temp-((int) (temp/10))*10; //jednotky rozdil teploty a desitek
}
for (i=1;i<=2;i++) { //cyklus zobrazeni udaje
output_low(0x7f); //vymaz display
if (i==1) {
output_high(LED_K1); //dva bloky pro sepnuti aktivniho segmentu na 1
output_low(LED_K2);
znak=znak1;
}
if (i==2) {
output_high(LED_K2);
output_low(LED_K1);
znak=znak2;
}
if (znak==1) output_b(0x4f); //blok if pro rozeznani zobrazeneho znaku
if (znak==2) output_b(0x12);
if (znak==3) output_b(0x06);
if (znak==4) output_b(0x4c);
if (znak==5) output_b(0x2c);
if (znak==6) output_b(0x20);
if (znak==7) output_b(0x0f);
if (znak==8) output_b(0x00);
if (znak==9) output_b(0x04);
if (znak==0) output_b(0x01);
Delay_ms(50);
}
// duty=104+(2,31*temperature); // .000416/(16*(1/4000000)) ....PWM presne podle helpu
// set_pwm1_duty(duty);
}
 
 
 
 
}
/programy/C/PIC/mereni/gmetr/gmetr.BAK
0,0 → 1,65
#include ".\gmetr.h"
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
 
#include "C:\library\CCS\lcd.c"
 
 
void main()
{
signed int16 stred;
signed int8 hodnota;
unsigned int8 i, offset;
 
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_2);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
 
lcd_init();
Delay_ms(100);
set_adc_channel(1);
 
LCD_gotoxy(1,1);
printf(lcd_putc,"Gmetr 0.1.2 Beta");
LCD_gotoxy(1,2);
printf(lcd_putc,"Kaklik@mlab.cz");
Delay_ms(500);
 
LCD_clr();
LCD_gotoxy(1,1);
printf(lcd_putc,"Clibration...");
 
stred = 0;
for(i=0;i<=127;i++)
{
Delay_ms(10);
stred = stred + read_adc();
}
stred = stred >> 7;
 
while(true)
{
hodnota = read_adc();
Delay_ms(50);
LCD_clr();
LCD_gotoxy(6,1);
printf(lcd_putc," %03ld ",(stred - hodnota));
if (hodnota > stred)
{
offset = hodnota - stred;
offset = (offset >> 5) + 8;
}
else
{
offset = stred - hodnota;
offset = offset >> 5;
}
LCD_gotoxy(offset,2);
printf(lcd_putc,"*");
}
}
/programy/C/PIC/mereni/gmetr/gmetr.HEX
0,0 → 1,87
:1000000000308A00842900000A108A100A11820731
:1000100028340C34013406340A108A100A1182077D
:1000200047346D34653474347234203430342E34B3
:1000300031342E34323420344234653474346134F3
:1000400000340A108A100A1182074B3461346B3471
:100050006C3469346B3440346D346C3461346234E4
:100060002E3463347A3400340A108A100A1182075D
:1000700043346C34693462347234613474346934B6
:100080006F346E342E342E342E3400340A108A101D
:100090000A1182072A34003436308400000803191C
:1000A00060280130A100A001A00B5428A10B532807
:1000B0004A30A000A00B5A2800000000800B5128F5
:1000C000003407080F39BD003C0EA000F030A00539
:1000D0002008F0393D04870006148316061000003E
:1000E000831206108316061083120034BA08031D0B
:1000F0007B2886107C288614831686108312BB0EFC
:100100003B08BC006120BB0E3B08BC0061200D30E9
:10011000A000A00B892800341430B6004C200F300A
:1001200083168705831286108316861083120610A5
:10013000831606108312AB012B08023C031CA8286F
:100140000230B6004C200330BC006120AB0A9C2872
:100150000D30A000A00BAA280230BC0061200D3099
:10016000A000A00BB128AB012B08023C031CC42843
:100170002B080420AC00BA012C08BB00762002300A
:10018000B6004C20AB0AB4288A11BD2901303602D2
:10019000B8003708023C031DCF284030B8073808A4
:1001A0008038B900BA013908BB0076200034350820
:1001B0000C3A0319E528063A0319ED28073A031902
:1001C000F328053A0319F828FD28BA010130BB00CD
:1001D00076200230B6004C2009290130B6000230EA
:1001E000B700C62009290130B600B700C62009298A
:1001F000BA011030BB007620092935081F3C031CCA
:1002000003290730B5050130BA003508BB00762058
:10021000092900340C30B500D72000340408B4009C
:10022000AE1F1A29B417341EB40AAD09AE09AD0ABF
:100230000319AE0A2E0EF038B000B007E23EB1004E
:10024000323EB3002E080F39B107B107B307E93EBC
:10025000B200B207B2072D0E0F39B207B307B20DC5
:10026000B30DB309B30D2D080F39B307B00D073027
:10027000AF000A30B307B203031C3A29B207B10337
:10028000031C3E29B107B003031C4229B007AF038A
:10029000031C46292F3084000730340534138403AF
:1002A0003405031D5A29341A840A341A5A29203075
:1002B000A00077298407333004020319341700089B
:1002C000A000031D6B29341B6B29341A7F29B41934
:1002D0006B2920307629B41F73292D30A0008403A8
:1002E0003413B4137729B41534123030A007AE019B
:1002F0000408AD002008B500D7202D088400840A2A
:10030000341F5B298A11472A84011F308305831615
:100310001F149F141F159F11FF308312A500831611
:100320001F109F101F119F1183121F139F138316FD
:100330009F1783121F149412A51225088316870095
:10034000831225162508831687008312A511250818
:1003500083168700003083129400831694000108EE
:10036000C73908388100831290010030A100920043
:1003700000308316920083128C286430B6004C2023
:100380000830A1001F08C73921049F000130B600C2
:10039000B700C620AB012B080C2000380319D42964
:1003A000AB0AB500D720CB290130B6000230B70028
:1003B000C620AB012B08212000380319E329AB0A22
:1003C000B500D720DA290230AB00FA30B6004C2055
:1003D000AB0BE5290A210130B600B700C620AB01FE
:1003E0002B08342000380319F929AB0AB500D720AF
:1003F000F029A701A601A90129087F3C031C102AA6
:100400000A30B6004C201F151F19042A83161E0837
:100410008312A6070318A70A1E08A707A90AFC2922
:10042000A70CA60CA70CA60CA70CA60CA70CA60C38
:10043000A70CA60CA70CA60CA70CA60C0130A705B0
:100440001F151F19212A83161E088312A800323097
:10045000B6004C200A210630B6000130B700C62095
:10046000A3012808A000A81BA3032602AB002708AD
:10047000AC002308031C230FAC022030B500D720AA
:100480000B3084002C08AE002B08AD000E29203064
:10049000B500D720A3012808A000A01BA303A1003A
:1004A000A71F552AA31F612A572AA31B782A2708AA
:1004B0002302031C782A031D612A26082102031C3B
:1004C000782AA3012808A81BA303A100260821025B
:1004D000A0002708031C270FA3022008AA002A0E49
:1004E000A000A00C0730A0052008083EAA008C2A16
:1004F000A3012808A81BA3032602A0002308031CAD
:10050000230F842A2708852A2702A3002008AA008F
:10051000AA0EAA0C0730AA052A08B6000230B700B6
:10052000C620AB012B084620003803199B2AAB0AD2
:0A053000B500D720922A202A6300AC
:02400E00393F38
:00000001FF
;PIC16F873
/programy/C/PIC/mereni/gmetr/gmetr.LST
0,0 → 1,885
CCS PCM C Compiler, Version 3.245, 27853 27-VI-07 00:22
 
Filename: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.lst
 
ROM used: 669 words (16%)
Largest free fragment is 2048
RAM used: 13 (7%) at main() level
31 (16%) worst case
Stack: 5 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 184
0003: NOP
.................... #include ".\gmetr.h"
.................... #include <16F873.h>
.................... //////// Standard Header file for the PIC16F873 device ////////////////
.................... #device PIC16F873
.................... #list
....................
.................... #device adc=10
.................... #fuses NOWDT,XT, NOPUT, NOPROTECT, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
.................... #use delay(clock=4000000)
*
004C: MOVLW 36
004D: MOVWF 04
004E: MOVF 00,W
004F: BTFSC 03.2
0050: GOTO 060
0051: MOVLW 01
0052: MOVWF 21
0053: CLRF 20
0054: DECFSZ 20,F
0055: GOTO 054
0056: DECFSZ 21,F
0057: GOTO 053
0058: MOVLW 4A
0059: MOVWF 20
005A: DECFSZ 20,F
005B: GOTO 05A
005C: NOP
005D: NOP
005E: DECFSZ 00,F
005F: GOTO 051
0060: RETLW 00
....................
....................
....................
.................... #define LCD_RS PIN_B1 // rizeni registru LCD displeje
.................... #define LCD_E PIN_B0 // enable LCD displeje
.................... #define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
....................
.................... #include "C:\library\CCS\lcd.c"
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
.................... // (c)miho 2002,2005
.................... //
.................... // Historie:
.................... //
.................... // 0.00 Uvodni verze se snadnou definici portu LCD displeje
.................... // 0.01 Oprava portu (zapomenute stare identifikatory)
.................... // 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
.................... // 0.03 Doplnena procedura lcd_clr pro smazani displeje
.................... //
.................... //
.................... // Funkce:
.................... //
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
.................... //
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
.................... // \f = \x0C - nova stranka - smazani displeje
.................... // \n = \x0A - odradkovani (prechod na druhou radku)
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
.................... // \r = \x0D - goto home to position 1,1
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
.................... //
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
.................... // nekontroluje parametry
.................... //
.................... // lcd_cursor_on zapne kurzor
.................... // lcd_cursor_off vypne kurzor
.................... //
.................... // lcd_clr smaze displej
.................... //
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
.................... // Na konci se provede lcd_gotoxy(1,1).
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku
.................... //
.................... //
.................... // Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... //
.................... //
.................... // Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
.................... // #define LCD_D1 PIN_C3 // D1
.................... // #define LCD_D2 PIN_C4 // D2
.................... // #define LCD_D3 PIN_C5 // D3
....................
....................
....................
....................
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje
....................
....................
....................
....................
.................... #ifdef LCD_DATA_LSB
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
.................... //
.................... #define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
.................... #define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
.................... #define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
.................... #define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
.................... //
.................... #if LCD_SHIFT>4 // kontrola mezi
.................... #error LCD data port LSB bit not in range 0..4
.................... #endif
.................... #endif
....................
....................
.................... // Definice konstant pro LCD display
.................... //
.................... #define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
.................... #define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
.................... #define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
....................
....................
.................... // Definice rezimu LCD displeje
.................... //
.................... BYTE const LCD_INIT_STRING[4] =
.................... {
.................... 0x28, // intrfejs 4 bity, 2 radky, font 5x7
.................... LCD_CURSOR_OFF_, // display on, kurzor off,
.................... 0x01, // clear displeje
.................... 0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
.................... };
....................
....................
.................... // Odesle nibble do displeje (posle data a klikne signalem e)
.................... //
.................... void lcd_send_nibble( BYTE n )
.................... {
.................... #ifdef LCD_DATA_LSB
.................... // data jsou za sebou na 4 bitech jednoho portu
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
0061: MOVF 07,W
0062: ANDLW 0F
0063: MOVWF 3D
0064: SWAPF 3C,W
0065: MOVWF 20
0066: MOVLW F0
0067: ANDWF 20,F
0068: MOVF 20,W
0069: ANDLW F0
006A: IORWF 3D,W
006B: MOVWF 07
.................... #else
.................... // data jsou na libovolnych 4 bitech libovolnych portu
.................... output_bit(LCD_D0,bit_test(n,0));
.................... output_bit(LCD_D1,bit_test(n,1));
.................... output_bit(LCD_D2,bit_test(n,2));
.................... output_bit(LCD_D3,bit_test(n,3));
.................... #endif
.................... output_bit(LCD_E,1); // vzestupna hrana
006C: BSF 06.0
006D: BSF 03.5
006E: BCF 06.0
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
006F: NOP
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
0070: BCF 03.5
0071: BCF 06.0
0072: BSF 03.5
0073: BCF 06.0
.................... }
0074: BCF 03.5
0075: RETLW 00
....................
....................
.................... // Odesle bajt do registru LCD
.................... //
.................... // Pokud je Adr=0 .. instrukcni registr
.................... // Pokud je Adr=1 .. datovy registr
.................... //
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n )
.................... {
.................... output_bit(LCD_RS,Adr); // vyber registr
0076: MOVF 3A,F
0077: BTFSS 03.2
0078: GOTO 07B
0079: BCF 06.1
007A: GOTO 07C
007B: BSF 06.1
007C: BSF 03.5
007D: BCF 06.1
.................... swap(n);
007E: BCF 03.5
007F: SWAPF 3B,F
.................... lcd_send_nibble(n); // posli horni pulku bajtu
0080: MOVF 3B,W
0081: MOVWF 3C
0082: CALL 061
.................... swap(n);
0083: SWAPF 3B,F
.................... lcd_send_nibble(n); // posli spodni pulku bajtu
0084: MOVF 3B,W
0085: MOVWF 3C
0086: CALL 061
.................... delay_us(40); // minimalni doba na provedeni prikazu
0087: MOVLW 0D
0088: MOVWF 20
0089: DECFSZ 20,F
008A: GOTO 089
.................... }
008B: RETLW 00
....................
....................
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
.................... //
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
.................... //
.................... void lcd_init()
.................... {
....................
.................... int i; // pocitadlo cyklu
....................
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
008C: MOVLW 14
008D: MOVWF 36
008E: CALL 04C
....................
.................... #ifdef LCD_DATA_LSB
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
008F: MOVLW 0F
0090: BSF 03.5
0091: ANDWF 07,F
.................... #endif
....................
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
0092: BCF 03.5
0093: BCF 06.1
0094: BSF 03.5
0095: BCF 06.1
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
0096: BCF 03.5
0097: BCF 06.0
0098: BSF 03.5
0099: BCF 06.0
....................
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
009A: BCF 03.5
009B: CLRF 2B
009C: MOVF 2B,W
009D: SUBLW 02
009E: BTFSS 03.0
009F: GOTO 0A8
.................... {
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
00A0: MOVLW 02
00A1: MOVWF 36
00A2: CALL 04C
.................... lcd_send_nibble(3); // rezim 8 bitu
00A3: MOVLW 03
00A4: MOVWF 3C
00A5: CALL 061
.................... }
00A6: INCF 2B,F
00A7: GOTO 09C
....................
.................... delay_us(40); // cas na zpracovani
00A8: MOVLW 0D
00A9: MOVWF 20
00AA: DECFSZ 20,F
00AB: GOTO 0AA
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
00AC: MOVLW 02
00AD: MOVWF 3C
00AE: CALL 061
.................... delay_us(40); // cas na zpracovani
00AF: MOVLW 0D
00B0: MOVWF 20
00B1: DECFSZ 20,F
00B2: GOTO 0B1
....................
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
00B3: CLRF 2B
00B4: MOVF 2B,W
00B5: SUBLW 02
00B6: BTFSS 03.0
00B7: GOTO 0C4
.................... {
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
00B8: MOVF 2B,W
00B9: CALL 004
00BA: MOVWF 2C
00BB: CLRF 3A
00BC: MOVF 2C,W
00BD: MOVWF 3B
00BE: CALL 076
.................... delay_ms(2);
00BF: MOVLW 02
00C0: MOVWF 36
00C1: CALL 04C
.................... }
00C2: INCF 2B,F
00C3: GOTO 0B4
.................... }
00C4: BCF 0A.3
00C5: GOTO 1BD (RETURN)
....................
....................
.................... // Proved presun kurzoru
.................... //
.................... // Pozice 1.1 je domu
.................... //
.................... void lcd_gotoxy( BYTE x, BYTE y)
.................... {
....................
.................... BYTE Adr;
....................
.................... Adr=x-1;
00C6: MOVLW 01
00C7: SUBWF 36,W
00C8: MOVWF 38
.................... if(y==2)
00C9: MOVF 37,W
00CA: SUBLW 02
00CB: BTFSS 03.2
00CC: GOTO 0CF
.................... Adr+=LCD_LINE_2;
00CD: MOVLW 40
00CE: ADDWF 38,F
....................
.................... lcd_send_byte(0,0x80|Adr);
00CF: MOVF 38,W
00D0: IORLW 80
00D1: MOVWF 39
00D2: CLRF 3A
00D3: MOVF 39,W
00D4: MOVWF 3B
00D5: CALL 076
.................... }
00D6: RETLW 00
....................
....................
.................... // Zapis znaku na displej, zpracovani ridicich znaku
.................... //
.................... void lcd_putc( char c)
.................... {
....................
.................... switch (c)
.................... {
00D7: MOVF 35,W
00D8: XORLW 0C
00D9: BTFSC 03.2
00DA: GOTO 0E5
00DB: XORLW 06
00DC: BTFSC 03.2
00DD: GOTO 0ED
00DE: XORLW 07
00DF: BTFSC 03.2
00E0: GOTO 0F3
00E1: XORLW 05
00E2: BTFSC 03.2
00E3: GOTO 0F8
00E4: GOTO 0FD
.................... case '\f' : lcd_send_byte(0,1); // smaz displej
00E5: CLRF 3A
00E6: MOVLW 01
00E7: MOVWF 3B
00E8: CALL 076
.................... delay_ms(2);
00E9: MOVLW 02
00EA: MOVWF 36
00EB: CALL 04C
.................... break;
00EC: GOTO 109
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
00ED: MOVLW 01
00EE: MOVWF 36
00EF: MOVLW 02
00F0: MOVWF 37
00F1: CALL 0C6
00F2: GOTO 109
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home
00F3: MOVLW 01
00F4: MOVWF 36
00F5: MOVWF 37
00F6: CALL 0C6
00F7: GOTO 109
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
00F8: CLRF 3A
00F9: MOVLW 10
00FA: MOVWF 3B
00FB: CALL 076
00FC: GOTO 109
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
00FD: MOVF 35,W
00FE: SUBLW 1F
00FF: BTFSS 03.0
0100: GOTO 103
0101: MOVLW 07
0102: ANDWF 35,F
.................... lcd_send_byte(1,c); break; // zapis znak
0103: MOVLW 01
0104: MOVWF 3A
0105: MOVF 35,W
0106: MOVWF 3B
0107: CALL 076
0108: GOTO 109
.................... }
.................... }
0109: RETLW 00
....................
....................
.................... // Zapni kurzor
.................... //
.................... void lcd_cursor_on()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_ON_);
.................... }
....................
....................
.................... // Vypni kurzor
.................... //
.................... void lcd_cursor_off()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_OFF_);
.................... }
....................
....................
.................... // Smaz displej
.................... //
.................... void lcd_clr()
.................... {
.................... lcd_putc('\f');
010A: MOVLW 0C
010B: MOVWF 35
010C: CALL 0D7
.................... }
010D: RETLW 00
....................
....................
.................... // Definice vlastnich fontu
.................... //
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
.................... // priklad pouziti definovanych znaku.
....................
....................
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje
.................... //
.................... void lcd_putc2(int Data)
.................... {
.................... lcd_send_byte(1,Data);
.................... }
....................
....................
.................... // Pomocne definice pro programovani obsahu CGRAM
.................... //
.................... #define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
.................... #define lcd_define_def(String) printf(lcd_putc2,String);
.................... #define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
....................
....................
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
.................... //
.................... #define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
....................
....................
.................... // Pripravene definice fontu vybranych znaku
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
.................... //
.................... #define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
.................... #define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
.................... #define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
.................... #define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
.................... #define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
.................... #define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
.................... #define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
.................... #define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
.................... #define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
.................... #define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
.................... #define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
.................... #define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
.................... #define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
.................... #define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
.................... #define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
.................... #define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
.................... #define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
.................... #define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
.................... #define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
.................... #define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
.................... #define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
.................... #define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
.................... #define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
.................... #define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
.................... #define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
.................... #define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
.................... #define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
.................... #define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
.................... #define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
.................... #define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
.................... #define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
.................... #define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
.................... #define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
.................... #define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
.................... #define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
....................
....................
.................... // Priklad pouziti definovanych znaku
.................... //
.................... //
.................... //void lcd_sample()
.................... //{
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
.................... // // jediny definicni retezec)
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
.................... // delay_ms(1000);
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
.................... // delay_ms(1000);
.................... //}
....................
....................
....................
.................... void main()
.................... {
*
0184: CLRF 04
0185: MOVLW 1F
0186: ANDWF 03,F
0187: BSF 03.5
0188: BSF 1F.0
0189: BSF 1F.1
018A: BSF 1F.2
018B: BCF 1F.3
.................... signed int16 stred;
.................... signed int8 hodnota;
.................... unsigned int8 i, offset;
....................
.................... setup_adc_ports(ALL_ANALOG);
*
018F: BSF 03.5
0190: BCF 1F.0
0191: BCF 1F.1
0192: BCF 1F.2
0193: BCF 1F.3
.................... setup_adc(ADC_CLOCK_DIV_2);
0194: BCF 03.5
0195: BCF 1F.6
0196: BCF 1F.7
0197: BSF 03.5
0198: BSF 1F.7
0199: BCF 03.5
019A: BSF 1F.0
.................... setup_spi(FALSE);
*
018C: MOVLW FF
018D: BCF 03.5
018E: MOVWF 25
*
019B: BCF 14.5
019C: BCF 25.5
019D: MOVF 25,W
019E: BSF 03.5
019F: MOVWF 07
01A0: BCF 03.5
01A1: BSF 25.4
01A2: MOVF 25,W
01A3: BSF 03.5
01A4: MOVWF 07
01A5: BCF 03.5
01A6: BCF 25.3
01A7: MOVF 25,W
01A8: BSF 03.5
01A9: MOVWF 07
01AA: MOVLW 00
01AB: BCF 03.5
01AC: MOVWF 14
01AD: BSF 03.5
01AE: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
01AF: MOVF 01,W
01B0: ANDLW C7
01B1: IORLW 08
01B2: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
01B3: BCF 03.5
01B4: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
01B5: MOVLW 00
01B6: MOVWF 21
01B7: MOVWF 12
01B8: MOVLW 00
01B9: BSF 03.5
01BA: MOVWF 12
....................
.................... lcd_init();
01BB: BCF 03.5
01BC: GOTO 08C
.................... Delay_ms(100);
01BD: MOVLW 64
01BE: MOVWF 36
01BF: CALL 04C
.................... set_adc_channel(1);
01C0: MOVLW 08
01C1: MOVWF 21
01C2: MOVF 1F,W
01C3: ANDLW C7
01C4: IORWF 21,W
01C5: MOVWF 1F
....................
.................... LCD_gotoxy(1,1);
01C6: MOVLW 01
01C7: MOVWF 36
01C8: MOVWF 37
01C9: CALL 0C6
.................... printf(lcd_putc,"Gmetr 0.1.2 Beta");
01CA: CLRF 2B
01CB: MOVF 2B,W
01CC: CALL 00C
01CD: IORLW 00
01CE: BTFSC 03.2
01CF: GOTO 1D4
01D0: INCF 2B,F
01D1: MOVWF 35
01D2: CALL 0D7
01D3: GOTO 1CB
.................... LCD_gotoxy(1,2);
01D4: MOVLW 01
01D5: MOVWF 36
01D6: MOVLW 02
01D7: MOVWF 37
01D8: CALL 0C6
.................... printf(lcd_putc,"Kaklik@mlab.cz");
01D9: CLRF 2B
01DA: MOVF 2B,W
01DB: CALL 021
01DC: IORLW 00
01DD: BTFSC 03.2
01DE: GOTO 1E3
01DF: INCF 2B,F
01E0: MOVWF 35
01E1: CALL 0D7
01E2: GOTO 1DA
.................... Delay_ms(500);
01E3: MOVLW 02
01E4: MOVWF 2B
01E5: MOVLW FA
01E6: MOVWF 36
01E7: CALL 04C
01E8: DECFSZ 2B,F
01E9: GOTO 1E5
....................
.................... LCD_clr();
01EA: CALL 10A
.................... LCD_gotoxy(1,1);
01EB: MOVLW 01
01EC: MOVWF 36
01ED: MOVWF 37
01EE: CALL 0C6
.................... printf(lcd_putc,"Clibration...");
01EF: CLRF 2B
01F0: MOVF 2B,W
01F1: CALL 034
01F2: IORLW 00
01F3: BTFSC 03.2
01F4: GOTO 1F9
01F5: INCF 2B,F
01F6: MOVWF 35
01F7: CALL 0D7
01F8: GOTO 1F0
....................
.................... stred = 0;
01F9: CLRF 27
01FA: CLRF 26
.................... for(i=0;i<=127;i++)
01FB: CLRF 29
01FC: MOVF 29,W
01FD: SUBLW 7F
01FE: BTFSS 03.0
01FF: GOTO 210
.................... {
.................... Delay_ms(10);
0200: MOVLW 0A
0201: MOVWF 36
0202: CALL 04C
.................... stred = stred + read_adc();
0203: BSF 1F.2
0204: BTFSC 1F.2
0205: GOTO 204
0206: BSF 03.5
0207: MOVF 1E,W
0208: BCF 03.5
0209: ADDWF 26,F
020A: BTFSC 03.0
020B: INCF 27,F
020C: MOVF 1E,W
020D: ADDWF 27,F
.................... }
020E: INCF 29,F
020F: GOTO 1FC
.................... stred = stred >> 7;
0210: RRF 27,F
0211: RRF 26,F
0212: RRF 27,F
0213: RRF 26,F
0214: RRF 27,F
0215: RRF 26,F
0216: RRF 27,F
0217: RRF 26,F
0218: RRF 27,F
0219: RRF 26,F
021A: RRF 27,F
021B: RRF 26,F
021C: RRF 27,F
021D: RRF 26,F
021E: MOVLW 01
021F: ANDWF 27,F
....................
.................... while(true)
.................... {
.................... hodnota = read_adc();
0220: BSF 1F.2
0221: BTFSC 1F.2
0222: GOTO 221
0223: BSF 03.5
0224: MOVF 1E,W
0225: BCF 03.5
0226: MOVWF 28
.................... Delay_ms(50);
0227: MOVLW 32
0228: MOVWF 36
0229: CALL 04C
.................... LCD_clr();
022A: CALL 10A
.................... LCD_gotoxy(6,1);
022B: MOVLW 06
022C: MOVWF 36
022D: MOVLW 01
022E: MOVWF 37
022F: CALL 0C6
.................... printf(lcd_putc," %03ld ",(stred - hodnota));
0230: CLRF 23
0231: MOVF 28,W
0232: MOVWF 20
0233: BTFSC 28.7
0234: DECF 23,F
0235: SUBWF 26,W
0236: MOVWF 2B
0237: MOVF 27,W
0238: MOVWF 2C
0239: MOVF 23,W
023A: BTFSS 03.0
023B: INCFSZ 23,W
023C: SUBWF 2C,F
023D: MOVLW 20
023E: MOVWF 35
023F: CALL 0D7
0240: MOVLW 0B
0241: MOVWF 04
0242: MOVF 2C,W
0243: MOVWF 2E
0244: MOVF 2B,W
0245: MOVWF 2D
0246: GOTO 10E
0247: MOVLW 20
0248: MOVWF 35
0249: CALL 0D7
.................... if (hodnota >= stred)
024A: CLRF 23
024B: MOVF 28,W
024C: MOVWF 20
024D: BTFSC 20.7
024E: DECF 23,F
024F: MOVWF 21
0250: BTFSS 27.7
0251: GOTO 255
0252: BTFSS 23.7
0253: GOTO 261
0254: GOTO 257
0255: BTFSC 23.7
0256: GOTO 278
0257: MOVF 27,W
0258: SUBWF 23,W
0259: BTFSS 03.0
025A: GOTO 278
025B: BTFSS 03.2
025C: GOTO 261
025D: MOVF 26,W
025E: SUBWF 21,W
025F: BTFSS 03.0
0260: GOTO 278
.................... {
.................... offset = hodnota - stred;
0261: CLRF 23
0262: MOVF 28,W
0263: BTFSC 28.7
0264: DECF 23,F
0265: MOVWF 21
0266: MOVF 26,W
0267: SUBWF 21,W
0268: MOVWF 20
0269: MOVF 27,W
026A: BTFSS 03.0
026B: INCFSZ 27,W
026C: SUBWF 23,F
026D: MOVF 20,W
026E: MOVWF 2A
.................... offset = (offset >> 5) + 8;
026F: SWAPF 2A,W
0270: MOVWF 20
0271: RRF 20,F
0272: MOVLW 07
0273: ANDWF 20,F
0274: MOVF 20,W
0275: ADDLW 08
0276: MOVWF 2A
.................... }
.................... else
0277: GOTO 28C
.................... {
.................... offset = stred - hodnota;
0278: CLRF 23
0279: MOVF 28,W
027A: BTFSC 28.7
027B: DECF 23,F
027C: SUBWF 26,W
027D: MOVWF 20
027E: MOVF 23,W
027F: BTFSS 03.0
0280: INCFSZ 23,W
0281: GOTO 284
0282: MOVF 27,W
0283: GOTO 285
0284: SUBWF 27,W
0285: MOVWF 23
0286: MOVF 20,W
0287: MOVWF 2A
.................... offset = offset >> 5;
0288: SWAPF 2A,F
0289: RRF 2A,F
028A: MOVLW 07
028B: ANDWF 2A,F
.................... }
.................... LCD_gotoxy(offset,2);
028C: MOVF 2A,W
028D: MOVWF 36
028E: MOVLW 02
028F: MOVWF 37
0290: CALL 0C6
.................... printf(lcd_putc,"*");
0291: CLRF 2B
0292: MOVF 2B,W
0293: CALL 046
0294: IORLW 00
0295: BTFSC 03.2
0296: GOTO 29B
0297: INCF 2B,F
0298: MOVWF 35
0299: CALL 0D7
029A: GOTO 292
.................... }
029B: GOTO 220
.................... }
029C: SLEEP
 
Configuration Fuses:
Word 1: 3F39 XT NOWDT NOPUT NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG
/programy/C/PIC/mereni/gmetr/gmetr.PJT
0,0 → 1,41
[PROJECT]
Target=gmetr.HEX
Development_Mode=
Processor=0x873F
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[gmetr.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=gmetr.c
 
[Windows]
0=0000 gmetr.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c
2=C:\library\CCS\lcd.c
3=C:\Program Files\PICC\devices\16F873.h
4=
5=
[Units]
Count=1
1=D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c (main)
/programy/C/PIC/mereni/gmetr/gmetr.SYM
0,0 → 1,80
015 CCP_1_LOW
015-016 CCP_1
016 CCP_1_HIGH
01B CCP_2_LOW
01B-01C CCP_2
01C CCP_2_HIGH
020 @SCRATCH
021 @SCRATCH
021 _RETURN_
022 @SCRATCH
023 @SCRATCH
024 @SCRATCH
025 @TRIS_C
026-027 main.stred
028 main.hodnota
029 main.i
02A main.offset
02B lcd_init.i
02B main.@SCRATCH
02C lcd_init.@SCRATCH
02C main.@SCRATCH
02D-02E @PRINTF_LD_273.P1
02F @PRINTF_LD_273.@SCRATCH
030 @PRINTF_LD_273.@SCRATCH
031 @PRINTF_LD_273.@SCRATCH
032 @PRINTF_LD_273.@SCRATCH
033 @PRINTF_LD_273.@SCRATCH
034 @PRINTF_LD_273.@SCRATCH
035 lcd_putc.c
036 lcd_gotoxy.x
036 @delay_ms1.P1
037 lcd_gotoxy.y
038 lcd_gotoxy.Adr
039 lcd_gotoxy.@SCRATCH
03A lcd_send_byte.Adr
03B lcd_send_byte.n
03C lcd_send_nibble.n
03D lcd_send_nibble.@SCRATCH
03E lcd_send_nibble.@SCRATCH
 
004C @delay_ms1
0004 @const35
0061 lcd_send_nibble
0076 lcd_send_byte
008C lcd_init
00C6 lcd_gotoxy
00D7 lcd_putc
010A lcd_clr
0184 main
000C @const10098
0021 @const10103
0034 @const10109
010E @PRINTF_LD_273
0046 @const10155
0184 @cinit
 
Project Files:
D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c
D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.h
C:\Program Files\PICC\devices\16F873.h
C:\library\CCS\lcd.c
 
Units:
D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c (main)
 
Compiler Settings:
Processor: PIC16F873
Pointer Size: 8
ADC Range: 0-1023
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.err
INHX8: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.hex
Symbols: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.sym
List: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.lst
Debug/COFF: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.cof
Call Tree: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.tre
Statistics: D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.sta
/programy/C/PIC/mereni/gmetr/gmetr.c
0,0 → 1,65
#include ".\gmetr.h"
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
 
#include "C:\library\CCS\lcd.c"
 
 
void main()
{
signed int16 stred;
signed int8 hodnota;
unsigned int8 i, offset;
 
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_2);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
 
lcd_init();
Delay_ms(100);
set_adc_channel(1);
 
LCD_gotoxy(1,1);
printf(lcd_putc,"Gmetr 0.1.2 Beta");
LCD_gotoxy(1,2);
printf(lcd_putc,"Kaklik@mlab.cz");
Delay_ms(500);
 
LCD_clr();
LCD_gotoxy(1,1);
printf(lcd_putc,"Clibration...");
 
stred = 0;
for(i=0;i<=127;i++)
{
Delay_ms(10);
stred = stred + read_adc();
}
stred = stred >> 7;
 
while(true)
{
hodnota = read_adc();
Delay_ms(50);
LCD_clr();
LCD_gotoxy(6,1);
printf(lcd_putc," %03ld ",(stred - hodnota));
if (hodnota >= stred)
{
offset = hodnota - stred;
offset = (offset >> 5) + 8;
}
else
{
offset = stred - hodnota;
offset = offset >> 5;
}
LCD_gotoxy(offset,2);
printf(lcd_putc,"*");
}
}
/programy/C/PIC/mereni/gmetr/gmetr.cof
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
/programy/C/PIC/mereni/gmetr/gmetr.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/mereni/gmetr/gmetr.sta
0,0 → 1,42
 
ROM used: 669 (16%)
669 (16%) including unused fragments
 
1 Average locations per line
8 Average locations per statement
 
RAM used: 13 (7%) at main() level
31 (16%) worst case
 
Lines Stmts % Files
----- ----- --- -----
66 39 45 D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.c
6 0 0 D:\KAKLIK\projekty\programy\PIC_C\mereni\gmetr\gmetr.h
244 0 0 C:\Program Files\PICC\devices\16F873.h
312 47 38 C:\library\CCS\lcd.c
----- -----
1256 172 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 3 1 @delay_ms1
0 8 1 0 @const35
0 21 3 3 lcd_send_nibble
0 22 3 2 lcd_send_byte
0 58 9 2 lcd_init
0 17 3 4 lcd_gotoxy
0 51 8 1 lcd_putc
0 4 1 0 lcd_clr
0 281 42 7 main
0 21 3 0 @const10098
0 19 3 0 @const10103
0 18 3 0 @const10109
0 118 18 8 @PRINTF_LD_273
0 6 1 0 @const10155
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 665 1379
00800-00FFF 0 2048
 
/programy/C/PIC/mereni/gmetr/gmetr.tre
0,0 → 1,215
ÀÄgmetr
ÀÄmain 0/281 Ram=7
ÃÄ??0??
ÃÄlcd_init 0/58 Ram=2
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@const35 0/8 Ram=0
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10098 0/21 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10103 0/19 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_clr 0/4 Ram=0
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10109 0/18 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_clr 0/4 Ram=0
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@PRINTF_LD_273 0/118 Ram=8
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10155 0/6 Ram=0
ÀÄlcd_putc 0/51 Ram=1
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÀÄlcd_send_byte 0/22 Ram=2
ÃÄlcd_send_nibble 0/21 Ram=3
ÀÄlcd_send_nibble 0/21 Ram=3
/programy/C/PIC/mereni/gmetr/gmetr.h
0,0 → 1,5
#include <16F873.h>
#device adc=10
#fuses NOWDT,XT, NOPUT, NOPROTECT, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use delay(clock=4000000)
 
/programy/C/PIC/mereni/gmetr/vssver.scc
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
/programy/C/PIC/mereni/PS2mys/PIC16F84/RUN.PIF
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
/programy/C/PIC/mereni/PS2mys/PIC16F84/Run.BAT
0,0 → 1,8
@echo off
:loop
picpgr reset PIC16F84 lpt2
picpgr run lpt2
pause
picpgr stop lpt2
pause
goto loop
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.BAK
0,0 → 1,57
#include "main.h"
#include "c:\library\kaklik\CSS\PS2.c"
 
#define SIGN_X 4
 
void trigger()
{
output_high(PIN_A0);
output_low(PIN_A0);
delay_us(100);
output_high(PIN_A0);
}
 
void flash_red() // blikne ledkou
{
output_high(LED_red);
Delay_ms(BLIK);
output_low(LED_red);
}
 
void flash_yellow() // blikne ledkou
{
output_high(LED_yellow);
Delay_ms(BLIK);
output_low(LED_yellow);
}
 
void main()
{
int8 X,y,tl=0;
int8 X_old,y_old,tl_old=0;
 
Delay_ms(500);
send(ENABLE_DATA_REPORTING);
 
while(true)
{
tl = read_byte(PRVNI);
x = read_byte(DRUHY);
y = read_byte(TRETI);
trigger();
 
 
if (bit_test(tl, SIGN_X))
{
output_high(LED_red);
output_low(LED_yellow);
}
else
{
output_high(LED_yellow);
output_low(LED_red);
}
}
}
 
 
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.HEX
0,0 → 1,38
:1000000000308A00D128000016308400000803194F
:10001000182801308D008C018C0B0C288D0B0B28BF
:100020004A308C008C0B122800000000800B09283D
:10003000DB28970183160614861083128610213060
:100040008C008C0B212883160610831206100630B4
:100050008C008C0B29280000831686148312861CC2
:100060002C2896011608073C031C52288316861478
:1000700083128618362815080139003A031D4228D4
:10008000061043280614831606108312150801393A
:1000900097070310950C831686148312861C4B2831
:1000A000960A322883168614831286185228170857
:1000B000FF3A0139003A031D5F2806106028061434
:1000C0008316061086148312861868288316622801
:1000D00069288316861483128618692806148316E5
:1000E00006108614831286187728831671287828BC
:1000F000831606148312E0289601160203188D2831
:10010000831686148312861C8A288316061483128B
:1001100006188B289601960A7D288316861483126A
:1001200086188D2883160614831206188D288316C8
:1001300086148312861C9728950196011608073CA1
:10014000031CBD288316861483128618A228031068
:10015000950C8316061400308312061801308C00AB
:100160000C0C8C0103188C170C089504831686144C
:100170008312861CB628960A9E2815088D00003426
:1001800083160510831205148316051083120510BB
:1001900021308C008C0BCA2883160510831205149D
:1001A000FC2884011F3083059101940102309500E1
:1001B000FA3096000428950BD828F43095001928B9
:1001C000E83083160317FF00831203137C200D0809
:1001D0009100023083160317FF00831203137C2063
:1001E0000D088F00023083160317FF0083120313DC
:1001F0007C200D089000C028111E072983160511C8
:100200008312051583168511831285110F29831614
:100210008511831285158316051183120511E028B7
:02022000630079
:02400E00F93F78
:00000001FF
;PIC16F84
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.LST
0,0 → 1,474
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\ps2mys\main.LST
 
ROM used: 273 (27%)
Largest free fragment is 751
RAM used: 9 (13%) at main() level
12 (18%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 0D1
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\PS2mys\main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 16
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: GOTO 0DB (RETURN)
.................... #fuses XT,NOWDT
....................
.................... #DEFINE DATA PIN_B0 // musi byt definovan kanal DATA
.................... #DEFINE CLK PIN_B1 // a taky hodiny CLK
....................
.................... #define PRVNI 1000 // nastaveni prodlevy pred zacatkem vysilani bajtu
.................... #define DRUHY 2
.................... #define TRETI DRUHY
....................
.................... // prikazy
.................... #define RESET 0xFF
.................... #define ENABLE_DATA_REPORTING 0xF4
.................... #define READ_DATA 0xEB
.................... #define STATUS_REQUEST 0xE9
.................... #define SET_REMOTE_MODE 0xF0
.................... #define SET_STREAM_MODE 0xEA
.................... #define GET_DEVICE_ID 0xF2
....................
.................... #DEFINE LED_yellow PIN_A3
.................... #DEFINE LED_red PIN_A2
....................
.................... #DEFINE BLIK 120 // doba rozsviceni led
....................
.................... #include "PS2.c"
.................... // Modul pro komunikaci s Mysi
....................
.................... void send(byte command)
.................... {
.................... int n;
0019: CLRF 17
.................... int parity=0;
....................
.................... //Request-to-send
.................... output_float(DATA);
001A: BSF 03.5
001B: BSF 06.0
.................... output_low(CLK);
001C: BCF 06.1
001D: BCF 03.5
001E: BCF 06.1
.................... delay_us(100);
001F: MOVLW 21
0020: MOVWF 0C
0021: DECFSZ 0C,F
0022: GOTO 021
.................... // start bit
.................... output_low(DATA);
0023: BSF 03.5
0024: BCF 06.0
0025: BCF 03.5
0026: BCF 06.0
.................... delay_us(20);
0027: MOVLW 06
0028: MOVWF 0C
0029: DECFSZ 0C,F
002A: GOTO 029
002B: NOP
.................... while(!input(CLK));
002C: BSF 03.5
002D: BSF 06.1
002E: BCF 03.5
002F: BTFSS 06.1
0030: GOTO 02C
.................... // 8 bitu
.................... for(n=0; n<8; n++)
0031: CLRF 16
0032: MOVF 16,W
0033: SUBLW 07
0034: BTFSS 03.0
0035: GOTO 052
.................... {
.................... while(input(CLK));
0036: BSF 03.5
0037: BSF 06.1
0038: BCF 03.5
0039: BTFSC 06.1
003A: GOTO 036
.................... output_bit(DATA, command & 1);
003B: MOVF 15,W
003C: ANDLW 01
003D: XORLW 00
003E: BTFSS 03.2
003F: GOTO 042
0040: BCF 06.0
0041: GOTO 043
0042: BSF 06.0
0043: BSF 03.5
0044: BCF 06.0
.................... parity += command & 1;
0045: BCF 03.5
0046: MOVF 15,W
0047: ANDLW 01
0048: ADDWF 17,F
.................... command>>=1;
0049: BCF 03.0
004A: RRF 15,F
.................... while(!input(CLK));
004B: BSF 03.5
004C: BSF 06.1
004D: BCF 03.5
004E: BTFSS 06.1
004F: GOTO 04B
.................... };
0050: INCF 16,F
0051: GOTO 032
.................... // parita
.................... while(input(CLK));
0052: BSF 03.5
0053: BSF 06.1
0054: BCF 03.5
0055: BTFSC 06.1
0056: GOTO 052
.................... output_bit(DATA, ~parity & 1);
0057: MOVF 17,W
0058: XORLW FF
0059: ANDLW 01
005A: XORLW 00
005B: BTFSS 03.2
005C: GOTO 05F
005D: BCF 06.0
005E: GOTO 060
005F: BSF 06.0
0060: BSF 03.5
0061: BCF 06.0
.................... while(!input(CLK));
0062: BSF 06.1
0063: BCF 03.5
0064: BTFSC 06.1
0065: GOTO 068
0066: BSF 03.5
0067: GOTO 062
0068: GOTO 069
.................... // stop bit
.................... while(input(CLK));
0069: BSF 03.5
006A: BSF 06.1
006B: BCF 03.5
006C: BTFSC 06.1
006D: GOTO 069
.................... output_bit(DATA, 1);
006E: BSF 06.0
006F: BSF 03.5
0070: BCF 06.0
.................... while(!input(CLK));
0071: BSF 06.1
0072: BCF 03.5
0073: BTFSC 06.1
0074: GOTO 077
0075: BSF 03.5
0076: GOTO 071
0077: GOTO 078
.................... output_float(DATA);
0078: BSF 03.5
0079: BSF 06.0
007A: BCF 03.5
007B: GOTO 0E0 (RETURN)
.................... }
....................
....................
.................... int8 read_byte(int8 const poradi)
.................... {
.................... int8 bajt;
.................... int8 i;
....................
.................... // cekani na komunikacni klid
.................... for (i=0; i<poradi; i++)
007C: CLRF 16
007D: SUBWF 16,W
007E: BTFSC 03.0
007F: GOTO 08D
.................... {
.................... if (!input(CLK) || !input(DATA)) i=0;
0080: BSF 03.5
0081: BSF 06.1
0082: BCF 03.5
0083: BTFSS 06.1
0084: GOTO 08A
0085: BSF 03.5
0086: BSF 06.0
0087: BCF 03.5
0088: BTFSC 06.0
0089: GOTO 08B
008A: CLRF 16
.................... };
008B: INCF 16,F
008C: GOTO 07D
....................
.................... // cekani na startbit
.................... while(input(CLK) || input(DATA));
008D: BSF 03.5
008E: BSF 06.1
008F: BCF 03.5
0090: BTFSC 06.1
0091: GOTO 08D
0092: BSF 03.5
0093: BSF 06.0
0094: BCF 03.5
0095: BTFSC 06.0
0096: GOTO 08D
.................... while(!input(CLK));
0097: BSF 03.5
0098: BSF 06.1
0099: BCF 03.5
009A: BTFSS 06.1
009B: GOTO 097
....................
.................... bajt = 0;
009C: CLRF 15
.................... for(i=0; i<8; i++)
009D: CLRF 16
009E: MOVF 16,W
009F: SUBLW 07
00A0: BTFSS 03.0
00A1: GOTO 0BD
.................... {
.................... while(input(CLK)); // ceka na nulu hodin
00A2: BSF 03.5
00A3: BSF 06.1
00A4: BCF 03.5
00A5: BTFSC 06.1
00A6: GOTO 0A2
....................
.................... bajt >>= 1;
00A7: BCF 03.0
00A8: RRF 15,F
.................... bajt |= input(DATA) << 7;
00A9: BSF 03.5
00AA: BSF 06.0
00AB: MOVLW 00
00AC: BCF 03.5
00AD: BTFSC 06.0
00AE: MOVLW 01
00AF: MOVWF 0C
00B0: RRF 0C,W
00B1: CLRF 0C
00B2: BTFSC 03.0
00B3: BSF 0C.7
00B4: MOVF 0C,W
00B5: IORWF 15,F
....................
.................... while(!input(CLK)); // ceka na jednicku hodin
00B6: BSF 03.5
00B7: BSF 06.1
00B8: BCF 03.5
00B9: BTFSS 06.1
00BA: GOTO 0B6
.................... };
00BB: INCF 16,F
00BC: GOTO 09E
.................... return (bajt);
00BD: MOVF 15,W
00BE: MOVWF 0D
00BF: RETLW 00
.................... }
....................
....................
.................... /*void read_all_byte(int8*st,*nd,*rd) // precte 3 bajty
.................... {
.................... int8 i;
....................
.................... // *st=read_byte(1st);
....................
.................... // cekani na startbit
.................... while(input(CLK) || input(DATA));
.................... while(!input(CLK));
.................... *nd = 0;
.................... for(i=0; i<8; i++)
.................... {
.................... while(input(CLK)); // ceka na nulu hodin
....................
.................... *nd |= input(DATA) << 7;
.................... *nd >>= 1;
....................
.................... while(!input(CLK)); // ceka na jednicku hodin
.................... };
....................
.................... // cekani na startbit
.................... while(input(CLK) || input(DATA));
.................... while(!input(CLK));
.................... *rd = 0;
.................... for(i=0; i<8; i++)
.................... {
.................... while(input(CLK)); // ceka na nulu hodin
....................
.................... *rd |= input(DATA) << 7;
.................... *rd >>= 1;
....................
.................... while(!input(CLK)); // ceka na jednicku hodin
.................... };
.................... }*/
....................
....................
.................... #define SIGN_X 4
....................
.................... void trigger()
.................... {
.................... output_high(PIN_A0);
00C0: BSF 03.5
00C1: BCF 05.0
00C2: BCF 03.5
00C3: BSF 05.0
.................... output_low(PIN_A0);
00C4: BSF 03.5
00C5: BCF 05.0
00C6: BCF 03.5
00C7: BCF 05.0
.................... delay_us(100);
00C8: MOVLW 21
00C9: MOVWF 0C
00CA: DECFSZ 0C,F
00CB: GOTO 0CA
.................... output_high(PIN_A0);
00CC: BSF 03.5
00CD: BCF 05.0
00CE: BCF 03.5
00CF: BSF 05.0
00D0: GOTO 0FC (RETURN)
.................... }
....................
.................... void flash_red() // blikne ledkou
.................... {
.................... output_high(LED_red);
.................... Delay_ms(BLIK);
.................... output_low(LED_red);
.................... }
....................
.................... void flash_yellow() // blikne ledkou
.................... {
.................... output_high(LED_yellow);
.................... Delay_ms(BLIK);
.................... output_low(LED_yellow);
.................... }
....................
.................... void main()
.................... {
.................... int8 X,y,tl=0;
*
00D4: CLRF 11
00D5: CLRF 14
.................... int8 X_old,y_old,tl_old=0;
*
00D1: CLRF 04
00D2: MOVLW 1F
00D3: ANDWF 03,F
....................
.................... Delay_ms(500);
*
00D6: MOVLW 02
00D7: MOVWF 15
00D8: MOVLW FA
00D9: MOVWF 16
00DA: GOTO 004
00DB: DECFSZ 15,F
00DC: GOTO 0D8
.................... send(ENABLE_DATA_REPORTING);
00DD: MOVLW F4
00DE: MOVWF 15
00DF: GOTO 019
....................
.................... while(true)
.................... {
.................... tl = read_byte(PRVNI);
00E0: MOVLW E8
00E1: BSF 03.5
00E2: BSF 03.6
00E3: MOVWF 7F
00E4: BCF 03.5
00E5: BCF 03.6
00E6: CALL 07C
00E7: MOVF 0D,W
00E8: MOVWF 11
.................... x = read_byte(DRUHY);
00E9: MOVLW 02
00EA: BSF 03.5
00EB: BSF 03.6
00EC: MOVWF 7F
00ED: BCF 03.5
00EE: BCF 03.6
00EF: CALL 07C
00F0: MOVF 0D,W
00F1: MOVWF 0F
.................... y = read_byte(TRETI);
00F2: MOVLW 02
00F3: BSF 03.5
00F4: BSF 03.6
00F5: MOVWF 7F
00F6: BCF 03.5
00F7: BCF 03.6
00F8: CALL 07C
00F9: MOVF 0D,W
00FA: MOVWF 10
.................... trigger();
00FB: GOTO 0C0
....................
....................
.................... if (bit_test(tl, SIGN_X))
00FC: BTFSS 11.4
00FD: GOTO 107
.................... {
.................... output_high(LED_red);
00FE: BSF 03.5
00FF: BCF 05.2
0100: BCF 03.5
0101: BSF 05.2
.................... output_low(LED_yellow);
0102: BSF 03.5
0103: BCF 05.3
0104: BCF 03.5
0105: BCF 05.3
.................... }
.................... else
0106: GOTO 10F
.................... {
.................... output_high(LED_yellow);
0107: BSF 03.5
0108: BCF 05.3
0109: BCF 03.5
010A: BSF 05.3
.................... output_low(LED_red);
010B: BSF 03.5
010C: BCF 05.2
010D: BCF 03.5
010E: BCF 05.2
.................... }
.................... }
010F: GOTO 0E0
.................... }
....................
0110: SLEEP
....................
....................
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.PJT
0,0 → 1,37
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F84\main.c
2=C:\PROGRAM FILES\PICC\devices\16F84.h
3=c:\library\kaklik\CCS\PS2.c
4=
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.SYM
0,0 → 1,32
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F main.X
010 main.y
011 main.tl
012 main.X_old
013 main.y_old
014 main.tl_old
015 send.command
015 read_byte.bajt
015 main.@SCRATCH
016 delay_ms.P1
016 send.n
016 read_byte.i
017 send.parity
017 read_byte.@SCRATCH
018 send.@SCRATCH
delay_us.P1
read_byte.poradi
 
0004 delay_ms
0019 send
007C read_byte
00C0 trigger
00D1 main
 
Project Files:
d:\@kaklik\programy\pic_c\ps2mys\main.c
D:\@Kaklik\programy\PIC_C\PS2mys\main.h
C:\PROGRAM FILES\PICC\devices\16F84.h
d:\@kaklik\programy\pic_c\ps2mys\PS2.c
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.c
0,0 → 1,57
#include "main.h"
#include "c:\library\kaklik\CCS\PS2.c"
 
#define SIGN_X 4
 
void trigger()
{
output_high(PIN_A0);
output_low(PIN_A0);
delay_us(100);
output_high(PIN_A0);
}
 
void flash_red() // blikne ledkou
{
output_high(LED_red);
Delay_ms(BLIK);
output_low(LED_red);
}
 
void flash_yellow() // blikne ledkou
{
output_high(LED_yellow);
Delay_ms(BLIK);
output_low(LED_yellow);
}
 
void main()
{
int8 X,y,tl=0;
int8 X_old,y_old,tl_old=0;
 
Delay_ms(500);
send(ENABLE_DATA_REPORTING);
 
while(true)
{
tl = read_byte(PRVNI);
x = read_byte(DRUHY);
y = read_byte(TRETI);
trigger();
 
 
if (bit_test(tl, SIGN_X))
{
output_high(LED_red);
output_low(LED_yellow);
}
else
{
output_high(LED_yellow);
output_low(LED_red);
}
}
}
 
 
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.cod
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
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.err
0,0 → 1,0
Error[51] c:\library\kaklik\CCS\PS2.c 48 : A numeric expression must appear here
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.h
0,0 → 1,24
#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,NOWDT
 
#DEFINE DATA PIN_B0 // musi byt definovan kanal DATA
#DEFINE CLK PIN_B1 // a taky hodiny CLK
 
#define PRVNI 1000 // nastaveni prodlevy pred zacatkem vysilani bajtu
#define DRUHY 2
#define TRETI DRUHY
 
// prikazy
#define RESET 0xFF
#define ENABLE_DATA_REPORTING 0xF4
#define READ_DATA 0xEB
#define STATUS_REQUEST 0xE9
#define SET_REMOTE_MODE 0xF0
#define SET_STREAM_MODE 0xEA
#define GET_DEVICE_ID 0xF2
 
#DEFINE LED_yellow PIN_A3
#DEFINE LED_red PIN_A2
 
#DEFINE BLIK 120 // doba rozsviceni led
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.sta
0,0 → 1,32
 
ROM used: 273 (27%)
751 (73%) including unused fragments
 
1 Average locations per line
4 Average locations per statement
 
RAM used: 9 (13%) at main() level
12 (18%) worst case
 
Lines Stmts % Files
----- ----- --- -----
58 25 34 d:\@kaklik\programy\pic_c\ps2mys\main.c
25 0 0 D:\@Kaklik\programy\PIC_C\PS2mys\main.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h
100 48 49 d:\@kaklik\programy\pic_c\ps2mys\PS2.c
----- -----
588 146 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 8 1 delay_ms
0 99 36 4 send
0 68 25 4 read_byte
0 17 6 0 trigger
0 64 23 7 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 269 751
 
/programy/C/PIC/mereni/PS2mys/PIC16F84/main.tre
0,0 → 1,9
ÀÄmain
ÀÄmain 0/64 Ram=7
ÃÄ??0??
ÃÄdelay_ms 0/21 Ram=1
ÃÄsend 0/99 Ram=4
ÃÄread_byte 0/68 Ram=4
ÃÄread_byte 0/68 Ram=4
ÃÄread_byte 0/68 Ram=4
ÀÄtrigger 0/17 Ram=0
/programy/C/PIC/mereni/PS2mys/PIC16F84/prg.bat
0,0 → 1,6
call picpgr stop
call picpgr erase pic16f84
call picpgr program main.hex hex pic16f84
call picpgr run
pause
call picpgr stop
/programy/C/PIC/mereni/PS2mys/PIC16F84/ps2.BAK
0,0 → 1,99
// Modul pro komunikaci s Mysi
 
void send(byte command)
{
int n;
int parity=0;
 
//Request-to-send
// output_float(DATA);
output_low(CLK);
delay_us(100);
// start bit
output_low(DATA);
delay_us(20);
while(!input(CLK));
// 8 bitu
for(n=0; n<8; n++)
{
while(input(CLK));
output_bit(DATA, command & 1);
parity += command & 1;
command>>=1;
while(!input(CLK));
};
// parita
while(input(CLK));
output_bit(DATA, ~parity & 1);
while(!input(CLK));
// stop bit
while(input(CLK));
output_bit(DATA, 1);
while(!input(CLK));
output_float(DATA);
}
 
 
int8 read_byte(int8 const poradi)
{
int8 bajt;
int8 i;
 
// cekani na komunikacni klid
for (i=0; i<poradi; i++)
{
if (!input(CLK) || !input(DATA)) i=0;
};
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
 
bajt = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
bajt >>= 1;
bajt |= input(DATA) << 7;
 
while(!input(CLK)); // ceka na jednicku hodin
};
return (bajt);
}
 
 
/*void read_all_byte(int8*st,*nd,*rd) // precte 3 bajty
{
int8 i;
 
// *st=read_byte(1st);
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
*nd = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
*nd |= input(DATA) << 7;
*nd >>= 1;
 
while(!input(CLK)); // ceka na jednicku hodin
};
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
*rd = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
*rd |= input(DATA) << 7;
*rd >>= 1;
 
while(!input(CLK)); // ceka na jednicku hodin
};
}*/
/programy/C/PIC/mereni/PS2mys/PIC16F84/ps2mouse.BAK
0,0 → 1,100
#include "main.h"
#include "ps2mouse.h"
 
void send(byte command)
{
int n;
int parity=0;
 
//Request-to-send
input(DATA);
output_low(CLK);
delay_us(100);
// start bit
output_low(DATA);
delay_us(20);
while(!input(CLK));
// 8 bitu
for(n=0; n<8; n++)
{
while(input(CLK));
output_bit(DATA, command & 1);
parity += command & 1;
command>>=1;
while(!input(CLK));
};
// parita
while(input(CLK));
output_bit(DATA, ~parity & 1);
while(!input(CLK));
// stop bit
while(input(CLK));
output_bit(DATA, 1);
while(!input(CLK));
output_float(DATA);
}
 
 
int8 read_byte(int8 const poradi)
{
int8 bajt;
int8 i;
 
// cekani na komunikacni klid
for (i=0; i<poradi; i++)
{
if (!input(CLK) || !input(DATA)) i=0;
};
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
 
bajt = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
bajt >>= 1;
bajt |= input(DATA) << 7;
 
while(!input(CLK)); // ceka na jednicku hodin
};
return (bajt);
}
 
 
/*void read_all_byte(int8*st,*nd,*rd) // precte 3 bajty
{
int8 i;
 
// *st=read_byte(1st);
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
*nd = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
*nd |= input(DATA) << 7;
*nd >>= 1;
 
while(!input(CLK)); // ceka na jednicku hodin
};
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
*rd = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
*rd |= input(DATA) << 7;
*rd >>= 1;
 
while(!input(CLK)); // ceka na jednicku hodin
};
}*/
/programy/C/PIC/mereni/PS2mys/PIC16F84/ps2mouse.c
0,0 → 1,97
void send(byte command)
{
int n;
int parity=0;
 
//Request-to-send
input(DATA);
output_low(CLK);
delay_us(100);
// start bit
output_low(DATA);
delay_us(20);
while(!input(CLK));
// 8 bitu
for(n=0; n<8; n++)
{
while(input(CLK));
output_bit(DATA, command & 1);
parity += command & 1;
command>>=1;
while(!input(CLK));
};
// parita
while(input(CLK));
output_bit(DATA, ~parity & 1);
while(!input(CLK));
// stop bit
while(input(CLK));
output_bit(DATA, 1);
while(!input(CLK));
output_float(DATA);
}
 
 
int8 read_byte(int8 const poradi)
{
int8 bajt;
int8 i;
 
// cekani na komunikacni klid
for (i=0; i<poradi; i++)
{
if (!input(CLK) || !input(DATA)) i=0;
};
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
 
bajt = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
bajt >>= 1;
bajt |= input(DATA) << 7;
 
while(!input(CLK)); // ceka na jednicku hodin
};
return (bajt);
}
 
 
/*void read_all_byte(int8*st,*nd,*rd) // precte 3 bajty
{
int8 i;
 
// *st=read_byte(1st);
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
*nd = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
*nd |= input(DATA) << 7;
*nd >>= 1;
 
while(!input(CLK)); // ceka na jednicku hodin
};
 
// cekani na startbit
while(input(CLK) || input(DATA));
while(!input(CLK));
*rd = 0;
for(i=0; i<8; i++)
{
while(input(CLK)); // ceka na nulu hodin
 
*rd |= input(DATA) << 7;
*rd >>= 1;
 
while(!input(CLK)); // ceka na jednicku hodin
};
}*/
/programy/C/PIC/mereni/PS2mys/PIC16F84/ps2mouse.h
0,0 → 1,18
 
#define PRVNI 1000 // nastaveni prodlevy pred zacatkem vysilani bajtu
#define DRUHY 2
#define TRETI DRUHY
 
 
// prikazy
#define RESET 0xFF
#define ENABLE_DATA_REPORTING 0xF4
#define READ_DATA 0xEB
#define STATUS_REQUEST 0xE9
#define SET_REMOTE_MODE 0xF0
#define SET_STREAM_MODE 0xEA
#define GET_DEVICE_ID 0xF2
 
void send(byte command);
int8 read_byte(int8 const poradi);
 
/programy/C/PIC/mereni/PS2mys/PIC16F84/vssver.scc
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
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.BAK
0,0 → 1,54
#include "D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.h"
 
#define LCD_RS PIN_A0 // rizeni registru LCD displeje
#define LCD_E PIN_A1 // enable LCD displeje
#define LCD_DATA_LSB PIN_B0 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
#include "C:\library\CCS\lcd.c"
 
#define TRIGGER_PIN PIN_B4
 
#DEFINE DATA PIN_B5 // musi byt definovan kanal DATA
#DEFINE CLK PIN_B6 // a taky hodiny CLK
#include "C:\library\kaklik\CCS\ps2.c"
 
 
 
void trigger()
{
output_high(TRIGGER_PIN);
delay_us(50);
output_low(TRIGGER_PIN);
}
 
void main()
{
signed int16 x=0,y=0;
signed int8 hodnota,dx,dy;
unsigned int8 tl1,tl2,tl3;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(FALSE);
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);
 
lcd_init();
Delay_ms(500);
 
send(SET_REMOTE_MODE);
 
while (true)
{
LCD_gotoxy(1,1);
printf(lcd_putc,"%X X=%ld Y=%ld TL1=%U TL2=%U TL3=%U",hodnota, x,y,tl1,tl2,tl3);
delay_ms(20);
send(READ_DATA);
hodnota=read_byte();
read_standard_byte(&dx,&dy,&tl1,&tl2,&tl3);
x+=dx;
y+=dy;
}
}
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.HEX
0,0 → 1,123
:1000000000308A00E22A00000A108A100A118207D2
:1000100028340C34013406340A108A100A1182077D
:1000200025345834203458343D3425346C34643409
:10003000203459343D3425346C3464342034543401
:100040004C3431343D342534553454344C3432340A
:100050003D3425345534203454344C3433343D3419
:1000600025345534003434308400000803194728FF
:100070000130F800F701F70B3B28F80B3A284A301B
:10008000F700F70B412800000000800B38280034EF
:100090000608F039BB003A080F393B048600851486
:1000A0008316851000008312851083168510831235
:1000B0000034B808031D5E2805105F280514831658
:1000C00005108312B90E3908BA004820B90E390854
:1000D000BA0048200D30F700F70B6C2800341430BC
:1000E000B4003320F0308316860583120510831682
:1000F000051083128510831685108312AB012B081F
:10010000023C031C8B280230B40033200330BA00B9
:100110004820AB0A7F280D30F700F70B8D280230FE
:10012000BA0048200D30F700F70B9428AB012B08DC
:10013000023C031CA7282B080420AC00B8012C08A3
:10014000B90059200230B4003320AB0A97288A1135
:10015000242BAD0183168616061383120613213055
:10016000F700F70BB12883168612831286128316C6
:1001700006178312061BB728AC012C08073C031C8A
:10018000DA28831606178312061BC1282B18CA28E3
:100190008612CB2886168316861283122B08013905
:1001A000AD070310AB0C831606178312061FD32866
:1001B000AC0ABD28831606178312061BDA282D0801
:1001C000FF3A0139003A031DE7288612E82886160F
:1001D0008316861206178312061BF0288316EA2858
:1001E0008316861686168312861EF8288316F22832
:1001F000831606178312061BF82883160617831228
:10020000061FFD28831686168312861EFD280034DD
:1002100001303402B6003508023C031D112940307C
:10022000B60736088038B700B8013708B90059203A
:10023000003433080C3A03192729063A03192F29E9
:10024000073A03193529053A03193A293F29B80114
:100250000130B90059200230B40033204B2901305D
:10026000B4000230B50008214B290130B400B500BC
:1002700008214B29B8011030B90059204B29330807
:100280001F3C031C45290730B3050130B800330873
:10029000B90059204B290034AC1B5E290F30F70000
:1002A0002B0EF7050A307702031859293030F7076B
:1002B0005B292C08F7077708B30019210F30AB052D
:1002C0000A302B020318662930306829AC132C0839
:1002D000AB072B08B30019218A11372B0408B20091
:1002E000AC1F7B292D30B30019218403AB09AC0965
:1002F000AB0A0319AC0A2C0EF038AE00AE07E23E92
:10030000AF00323EB1002C080F39AF07AF07B1077D
:10031000E93EB000B007B0072B0E0F39B007B107A8
:10032000B00DB10DB109B10D2B080F39B107AE0DEC
:100330000730AD000A30B107B003031C9B29B0079A
:10034000AF03031C9F29AF07AE03031CA329AE070D
:10035000AD03031CA7292D30840007303205840724
:10036000313004020319D0290008F700031DBE290B
:10037000321ACE29B219C0292030C1290830B20062
:100380003030F707AC010408AB007708AD00770800
:10039000B30019212B0884002D08F700840AB02926
:1003A0000008F7003030F7077708B3001921003450
:1003B0003208F80131020318E0293108F700EC296E
:1003C000F7010830B300B10DF70D320877020318BA
:1003D000F700F80DB30BE32900343013B0122F08E7
:1003E000B1006430B200D8217708AF007808031D4F
:1003F000172AB01A172AB019252A301B052A3018D7
:10040000052A3019052AB01B252A301C112AB01BD9
:10041000252A301B112A3018252A3019112AB01B21
:10042000252A2030301E3030B3001921252AB0167D
:10043000B01F212A78088000F8002D30B300192160
:10044000B01330307807B3001921301B302A2F0841
:10045000B1000A30B200D8217708AF003017F62972
:10046000B01F352A2D30B300192130302F07B300CB
:10047000192100343510831606178312061B3B2AF8
:10048000831686168312861A3B2A83160617831252
:10049000061F452AB301B4013408073C031C7C2A1B
:1004A000831606178312061B502A0310B30C8316FB
:1004B000861600308312861A0130F700770CF70198
:1004C0000318F7177708B304003035180130B60069
:1004D0008316861600308312861A01303606F8001D
:1004E0007818742A3510752A351483160617831266
:1004F000061F752AB40A4C2A831606178312061B98
:100500007C2A003035180130B6008316861600307C
:100510008312861A01303606F8007818912A3510B1
:10052000922A3514831606178312061F922A831601
:1005300006178312061B972A831606178312061FB7
:100540009C2A3308F80000343A227808B0003A2296
:100550007808B1003A227808B20030080839083C1F
:10056000031DB82A2B0884003108003C8000BC2AF7
:100570002B0884003108800030081039103C031D1E
:10058000C72A2C0884003208003C8000CB2A2C08A3
:100590008400320880002D08840030080139800072
:1005A0002E0884000310300C013980002F088400CD
:1005B000300CF700F70C3F30F70577080139800061
:1005C0008A11A52B84011F30830583161F129F12E9
:1005D0001B0880399B0007309C001C0883120D13F8
:1005E000603083168F008312A101A201A301A40130
:1005F00083161F129F121B0880399B0083121F1045
:100600009412831606118614061200308312940089
:10061000831694000108C7390838810083129001BD
:100620000030F800920000308316920007309C00E2
:1006300005080330F700F70B1B2B1C0883120D1362
:1006400083169D0183126F280230AB00FA30B4008C
:100650003320AB0B262BF030AB00A9200130B400C7
:10066000B50008212508AB003730AC004C292030FC
:10067000B30019215830B30019213D30B3001921BE
:10068000103084002208AC002108AB006E2120301D
:10069000B30019215930B30019213D30B30019219D
:1006A000103084002408AC002308AB006E210E300B
:1006B000AB002B080C20AB0AF700B3001921133054
:1006C0002B02031D592B2808AF001830B000ED2174
:1006D0000330AC002030B3001921AC0B6A2B15306D
:1006E000AD002D080C20AD0AF700B3001921193018
:1006F0002D02031D712B2908AF001830B000ED2129
:100700001B30AE002E080C20AE0AF700B3001921F2
:1007100020302E02031D822B2A08AF001830B000B3
:10072000ED211430B4003320EB30AB00A9203A2285
:100730007808A5002630AB002730AC002830AD008B
:100740002930AE002A30AF00A42AFA012608A61BE1
:10075000FA03A1070318A20A7A08A207FA012708D8
:10076000A71BFA03A3070318A40A7A08A4072E2BD1
:02077000630024
:04400E00783FFF3FB9
:00000001FF
;PIC16F88
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.LST
0,0 → 1,1177
CCS PCM C Compiler, Version 3.221, 27853 19-XII-05 23:22
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.LST
 
ROM used: 953 words (23%)
Largest free fragment is 2048
RAM used: 19 (11%) at main() level
33 (19%) worst case
Stack: 5 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 2E2
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... #device adc=8
.................... #fuses NOWDT,INTRC_IO, NOPUT, MCLR, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
.................... #use delay(clock=4000000)
*
0033: MOVLW 34
0034: MOVWF 04
0035: MOVF 00,W
0036: BTFSC 03.2
0037: GOTO 047
0038: MOVLW 01
0039: MOVWF 78
003A: CLRF 77
003B: DECFSZ 77,F
003C: GOTO 03B
003D: DECFSZ 78,F
003E: GOTO 03A
003F: MOVLW 4A
0040: MOVWF 77
0041: DECFSZ 77,F
0042: GOTO 041
0043: NOP
0044: NOP
0045: DECFSZ 00,F
0046: GOTO 038
0047: RETLW 00
....................
....................
....................
.................... #define LCD_RS PIN_A0 // rizeni registru LCD displeje
.................... #define LCD_E PIN_A1 // enable LCD displeje
.................... #define LCD_DATA_LSB PIN_B0 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... #include "C:\library\CCS\lcd.c"
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
.................... // (c)miho 2002,2005
.................... //
.................... // Historie:
.................... //
.................... // 0.00 Uvodni verze se snadnou definici portu LCD displeje
.................... // 0.01 Oprava portu (zapomenute stare identifikatory)
.................... // 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
.................... // 0.03 Doplnena procedura lcd_clr pro smazani displeje
.................... //
.................... //
.................... // Funkce:
.................... //
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
.................... //
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
.................... // \f = \x0C - nova stranka - smazani displeje
.................... // \n = \x0A - odradkovani (prechod na druhou radku)
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
.................... // \r = \x0D - goto home to position 1,1
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
.................... //
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
.................... // nekontroluje parametry
.................... //
.................... // lcd_cursor_on zapne kurzor
.................... // lcd_cursor_off vypne kurzor
.................... //
.................... // lcd_clr smaze displej
.................... //
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
.................... // Na konci se provede lcd_gotoxy(1,1).
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku
.................... //
.................... //
.................... // Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... //
.................... //
.................... // Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
.................... // #define LCD_D1 PIN_C3 // D1
.................... // #define LCD_D2 PIN_C4 // D2
.................... // #define LCD_D3 PIN_C5 // D3
....................
....................
....................
....................
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje
....................
....................
....................
....................
.................... #ifdef LCD_DATA_LSB
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
.................... //
.................... #define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
.................... #define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
.................... #define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
.................... #define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
.................... //
.................... #if LCD_SHIFT>4 // kontrola mezi
.................... #error LCD data port LSB bit not in range 0..4
.................... #endif
.................... #endif
....................
....................
.................... // Definice konstant pro LCD display
.................... //
.................... #define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
.................... #define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
.................... #define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
....................
....................
.................... // Definice rezimu LCD displeje
.................... //
.................... BYTE const LCD_INIT_STRING[4] =
.................... {
.................... 0x28, // intrfejs 4 bity, 2 radky, font 5x7
.................... LCD_CURSOR_OFF_, // display on, kurzor off,
.................... 0x01, // clear displeje
.................... 0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
.................... };
....................
....................
.................... // Odesle nibble do displeje (posle data a klikne signalem e)
.................... //
.................... void lcd_send_nibble( BYTE n )
.................... {
.................... #ifdef LCD_DATA_LSB
.................... // data jsou za sebou na 4 bitech jednoho portu
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
0048: MOVF 06,W
0049: ANDLW F0
004A: MOVWF 3B
004B: MOVF 3A,W
004C: ANDLW 0F
004D: IORWF 3B,W
004E: MOVWF 06
.................... #else
.................... // data jsou na libovolnych 4 bitech libovolnych portu
.................... output_bit(LCD_D0,bit_test(n,0));
.................... output_bit(LCD_D1,bit_test(n,1));
.................... output_bit(LCD_D2,bit_test(n,2));
.................... output_bit(LCD_D3,bit_test(n,3));
.................... #endif
.................... output_bit(LCD_E,1); // vzestupna hrana
004F: BSF 05.1
0050: BSF 03.5
0051: BCF 05.1
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
0052: NOP
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
0053: BCF 03.5
0054: BCF 05.1
0055: BSF 03.5
0056: BCF 05.1
.................... }
0057: BCF 03.5
0058: RETLW 00
....................
....................
.................... // Odesle bajt do registru LCD
.................... //
.................... // Pokud je Adr=0 .. instrukcni registr
.................... // Pokud je Adr=1 .. datovy registr
.................... //
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n )
.................... {
.................... output_bit(LCD_RS,Adr); // vyber registr
0059: MOVF 38,F
005A: BTFSS 03.2
005B: GOTO 05E
005C: BCF 05.0
005D: GOTO 05F
005E: BSF 05.0
005F: BSF 03.5
0060: BCF 05.0
.................... swap(n);
0061: BCF 03.5
0062: SWAPF 39,F
.................... lcd_send_nibble(n); // posli horni pulku bajtu
0063: MOVF 39,W
0064: MOVWF 3A
0065: CALL 048
.................... swap(n);
0066: SWAPF 39,F
.................... lcd_send_nibble(n); // posli spodni pulku bajtu
0067: MOVF 39,W
0068: MOVWF 3A
0069: CALL 048
.................... delay_us(40); // minimalni doba na provedeni prikazu
006A: MOVLW 0D
006B: MOVWF 77
006C: DECFSZ 77,F
006D: GOTO 06C
.................... }
006E: RETLW 00
....................
....................
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
.................... //
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
.................... //
.................... void lcd_init()
.................... {
....................
.................... int i; // pocitadlo cyklu
....................
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
006F: MOVLW 14
0070: MOVWF 34
0071: CALL 033
....................
.................... #ifdef LCD_DATA_LSB
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
0072: MOVLW F0
0073: BSF 03.5
0074: ANDWF 06,F
.................... #endif
....................
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
0075: BCF 03.5
0076: BCF 05.0
0077: BSF 03.5
0078: BCF 05.0
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
0079: BCF 03.5
007A: BCF 05.1
007B: BSF 03.5
007C: BCF 05.1
....................
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
007D: BCF 03.5
007E: CLRF 2B
007F: MOVF 2B,W
0080: SUBLW 02
0081: BTFSS 03.0
0082: GOTO 08B
.................... {
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
0083: MOVLW 02
0084: MOVWF 34
0085: CALL 033
.................... lcd_send_nibble(3); // rezim 8 bitu
0086: MOVLW 03
0087: MOVWF 3A
0088: CALL 048
.................... }
0089: INCF 2B,F
008A: GOTO 07F
....................
.................... delay_us(40); // cas na zpracovani
008B: MOVLW 0D
008C: MOVWF 77
008D: DECFSZ 77,F
008E: GOTO 08D
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
008F: MOVLW 02
0090: MOVWF 3A
0091: CALL 048
.................... delay_us(40); // cas na zpracovani
0092: MOVLW 0D
0093: MOVWF 77
0094: DECFSZ 77,F
0095: GOTO 094
....................
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
0096: CLRF 2B
0097: MOVF 2B,W
0098: SUBLW 02
0099: BTFSS 03.0
009A: GOTO 0A7
.................... {
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
009B: MOVF 2B,W
009C: CALL 004
009D: MOVWF 2C
009E: CLRF 38
009F: MOVF 2C,W
00A0: MOVWF 39
00A1: CALL 059
.................... delay_ms(2);
00A2: MOVLW 02
00A3: MOVWF 34
00A4: CALL 033
.................... }
00A5: INCF 2B,F
00A6: GOTO 097
.................... }
00A7: BCF 0A.3
00A8: GOTO 324 (RETURN)
....................
....................
.................... // Proved presun kurzoru
.................... //
.................... // Pozice 1.1 je domu
.................... //
.................... void lcd_gotoxy( BYTE x, BYTE y)
.................... {
....................
.................... BYTE Adr;
....................
.................... Adr=x-1;
*
0108: MOVLW 01
0109: SUBWF 34,W
010A: MOVWF 36
.................... if(y==2)
010B: MOVF 35,W
010C: SUBLW 02
010D: BTFSS 03.2
010E: GOTO 111
.................... Adr+=LCD_LINE_2;
010F: MOVLW 40
0110: ADDWF 36,F
....................
.................... lcd_send_byte(0,0x80|Adr);
0111: MOVF 36,W
0112: IORLW 80
0113: MOVWF 37
0114: CLRF 38
0115: MOVF 37,W
0116: MOVWF 39
0117: CALL 059
.................... }
0118: RETLW 00
....................
....................
.................... // Zapis znaku na displej, zpracovani ridicich znaku
.................... //
.................... void lcd_putc( char c)
.................... {
....................
.................... switch (c)
.................... {
0119: MOVF 33,W
011A: XORLW 0C
011B: BTFSC 03.2
011C: GOTO 127
011D: XORLW 06
011E: BTFSC 03.2
011F: GOTO 12F
0120: XORLW 07
0121: BTFSC 03.2
0122: GOTO 135
0123: XORLW 05
0124: BTFSC 03.2
0125: GOTO 13A
0126: GOTO 13F
.................... case '\f' : lcd_send_byte(0,1); // smaz displej
0127: CLRF 38
0128: MOVLW 01
0129: MOVWF 39
012A: CALL 059
.................... delay_ms(2);
012B: MOVLW 02
012C: MOVWF 34
012D: CALL 033
.................... break;
012E: GOTO 14B
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
012F: MOVLW 01
0130: MOVWF 34
0131: MOVLW 02
0132: MOVWF 35
0133: CALL 108
0134: GOTO 14B
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home
0135: MOVLW 01
0136: MOVWF 34
0137: MOVWF 35
0138: CALL 108
0139: GOTO 14B
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
013A: CLRF 38
013B: MOVLW 10
013C: MOVWF 39
013D: CALL 059
013E: GOTO 14B
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
013F: MOVF 33,W
0140: SUBLW 1F
0141: BTFSS 03.0
0142: GOTO 145
0143: MOVLW 07
0144: ANDWF 33,F
.................... lcd_send_byte(1,c); break; // zapis znak
0145: MOVLW 01
0146: MOVWF 38
0147: MOVF 33,W
0148: MOVWF 39
0149: CALL 059
014A: GOTO 14B
.................... }
.................... }
014B: RETLW 00
....................
....................
.................... // Zapni kurzor
.................... //
.................... void lcd_cursor_on()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_ON_);
.................... }
....................
....................
.................... // Vypni kurzor
.................... //
.................... void lcd_cursor_off()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_OFF_);
.................... }
....................
....................
.................... // Smaz displej
.................... //
.................... void lcd_clr()
.................... {
.................... lcd_putc('\f');
.................... }
....................
....................
.................... // Definice vlastnich fontu
.................... //
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
.................... // priklad pouziti definovanych znaku.
....................
....................
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje
.................... //
.................... void lcd_putc2(int Data)
.................... {
.................... lcd_send_byte(1,Data);
.................... }
....................
....................
.................... // Pomocne definice pro programovani obsahu CGRAM
.................... //
.................... #define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
.................... #define lcd_define_def(String) printf(lcd_putc2,String);
.................... #define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
....................
....................
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
.................... //
.................... #define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
....................
....................
.................... // Pripravene definice fontu vybranych znaku
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
.................... //
.................... #define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
.................... #define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
.................... #define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
.................... #define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
.................... #define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
.................... #define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
.................... #define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
.................... #define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
.................... #define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
.................... #define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
.................... #define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
.................... #define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
.................... #define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
.................... #define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
.................... #define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
.................... #define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
.................... #define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
.................... #define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
.................... #define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
.................... #define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
.................... #define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
.................... #define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
.................... #define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
.................... #define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
.................... #define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
.................... #define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
.................... #define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
.................... #define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
.................... #define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
.................... #define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
.................... #define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
.................... #define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
.................... #define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
.................... #define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
.................... #define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
....................
....................
.................... // Priklad pouziti definovanych znaku
.................... //
.................... //
.................... //void lcd_sample()
.................... //{
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
.................... // // jediny definicni retezec)
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
.................... // delay_ms(1000);
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
.................... // delay_ms(1000);
.................... //}
....................
....................
.................... #define TRIGGER_PIN PIN_B4
....................
.................... #DEFINE DATA PIN_B5 // musi byt definovan kanal DATA
.................... #DEFINE CLK PIN_B6 // a taky hodiny CLK
.................... #include "C:\library\kaklik\CCS\ps2.c"
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // Modul pro komunikaci s PS/2 mysi
.................... //
.................... // #DEFINE DATA PIN_B0 // musi byt definovan kanal DATA
.................... // #DEFINE CLK PIN_B1 // a taky hodiny CLK
.................... //
.................... ////////////////////////////////////////////////////////////////////////////////
....................
.................... #define PRVNI 1000 // nastaveni prodlevy pred zacatkem vysilani bajtu
.................... #define DRUHY 2
.................... #define TRETI DRUHY
....................
.................... // prikazy
.................... #define RESET 0xFF
.................... #define ENABLE_DATA_REPORTING 0xF4
.................... #define READ_DATA 0xEB
.................... #define STATUS_REQUEST 0xE9
.................... #define SET_REMOTE_MODE 0xF0
.................... #define SET_STREAM_MODE 0xEA
.................... #define GET_DEVICE_ID 0xF2
....................
....................
.................... void send(byte command)
.................... {
.................... unsigned int8 n;
.................... unsigned int8 parity=0;
*
00A9: CLRF 2D
....................
.................... //Request-to-send
.................... output_float(DATA);
00AA: BSF 03.5
00AB: BSF 06.5
.................... output_low(CLK);
00AC: BCF 06.6
00AD: BCF 03.5
00AE: BCF 06.6
.................... delay_us(100);
00AF: MOVLW 21
00B0: MOVWF 77
00B1: DECFSZ 77,F
00B2: GOTO 0B1
.................... // start bit
.................... output_low(DATA);
00B3: BSF 03.5
00B4: BCF 06.5
00B5: BCF 03.5
00B6: BCF 06.5
.................... while(input(CLK)); // ceka se na hodiny od mysi (mys zataha za hodiny)
00B7: BSF 03.5
00B8: BSF 06.6
00B9: BCF 03.5
00BA: BTFSC 06.6
00BB: GOTO 0B7
.................... // 8 bitu
.................... for(n=0; n<8; n++)
00BC: CLRF 2C
00BD: MOVF 2C,W
00BE: SUBLW 07
00BF: BTFSS 03.0
00C0: GOTO 0DA
.................... {
.................... while(input(CLK));
00C1: BSF 03.5
00C2: BSF 06.6
00C3: BCF 03.5
00C4: BTFSC 06.6
00C5: GOTO 0C1
.................... output_bit(DATA, command & 1);
00C6: BTFSC 2B.0
00C7: GOTO 0CA
00C8: BCF 06.5
00C9: GOTO 0CB
00CA: BSF 06.5
00CB: BSF 03.5
00CC: BCF 06.5
.................... parity += command & 1;
00CD: BCF 03.5
00CE: MOVF 2B,W
00CF: ANDLW 01
00D0: ADDWF 2D,F
.................... command >>= 1;
00D1: BCF 03.0
00D2: RRF 2B,F
.................... while(!input(CLK));
00D3: BSF 03.5
00D4: BSF 06.6
00D5: BCF 03.5
00D6: BTFSS 06.6
00D7: GOTO 0D3
.................... };
00D8: INCF 2C,F
00D9: GOTO 0BD
.................... // parita
.................... while(input(CLK));
00DA: BSF 03.5
00DB: BSF 06.6
00DC: BCF 03.5
00DD: BTFSC 06.6
00DE: GOTO 0DA
.................... output_bit(DATA, ~parity & 1);
00DF: MOVF 2D,W
00E0: XORLW FF
00E1: ANDLW 01
00E2: XORLW 00
00E3: BTFSS 03.2
00E4: GOTO 0E7
00E5: BCF 06.5
00E6: GOTO 0E8
00E7: BSF 06.5
00E8: BSF 03.5
00E9: BCF 06.5
.................... while(!input(CLK));
00EA: BSF 06.6
00EB: BCF 03.5
00EC: BTFSC 06.6
00ED: GOTO 0F0
00EE: BSF 03.5
00EF: GOTO 0EA
....................
.................... // stop bit
.................... output_float(DATA);
00F0: BSF 03.5
00F1: BSF 06.5
.................... while(input(DATA)); // mys musi sama jeste jednou zatahat za hodiny a data
00F2: BSF 06.5
00F3: BCF 03.5
00F4: BTFSS 06.5
00F5: GOTO 0F8
00F6: BSF 03.5
00F7: GOTO 0F2
.................... while(input(CLK));
00F8: BSF 03.5
00F9: BSF 06.6
00FA: BCF 03.5
00FB: BTFSC 06.6
00FC: GOTO 0F8
....................
.................... // ceka se az nastane klidovy stav
.................... while(!input(CLK) || !input(DATA));
00FD: BSF 03.5
00FE: BSF 06.6
00FF: BCF 03.5
0100: BTFSS 06.6
0101: GOTO 0FD
0102: BSF 03.5
0103: BSF 06.5
0104: BCF 03.5
0105: BTFSS 06.5
0106: GOTO 0FD
.................... }
0107: RETLW 00
....................
....................
.................... int8 read_byte() // dodelat paritu
.................... {
.................... unsigned int8 bajt;
.................... unsigned int8 i;
.................... int1 parity=0;
*
023A: BCF 35.0
....................
.................... // cekani na startbit
.................... while(input(CLK) || input(DATA)); // oba signaly musi byt v 0
023B: BSF 03.5
023C: BSF 06.6
023D: BCF 03.5
023E: BTFSC 06.6
023F: GOTO 23B
0240: BSF 03.5
0241: BSF 06.5
0242: BCF 03.5
0243: BTFSC 06.5
0244: GOTO 23B
.................... while(!input(CLK)); // ceka se na nabeznou hranu hodin
0245: BSF 03.5
0246: BSF 06.6
0247: BCF 03.5
0248: BTFSS 06.6
0249: GOTO 245
....................
.................... bajt = 0;
024A: CLRF 33
.................... for(i=0; i<8; i++)
024B: CLRF 34
024C: MOVF 34,W
024D: SUBLW 07
024E: BTFSS 03.0
024F: GOTO 27C
.................... {
.................... while(input(CLK)); // ceka na nulu hodin
0250: BSF 03.5
0251: BSF 06.6
0252: BCF 03.5
0253: BTFSC 06.6
0254: GOTO 250
....................
.................... bajt >>= 1;
0255: BCF 03.0
0256: RRF 33,F
.................... bajt |= input(DATA) << 7; // zapise se stav do promene
0257: BSF 03.5
0258: BSF 06.5
0259: MOVLW 00
025A: BCF 03.5
025B: BTFSC 06.5
025C: MOVLW 01
025D: MOVWF 77
025E: RRF 77,W
025F: CLRF 77
0260: BTFSC 03.0
0261: BSF 77.7
0262: MOVF 77,W
0263: IORWF 33,F
.................... parity^=input(DATA);
0264: MOVLW 00
0265: BTFSC 35.0
0266: MOVLW 01
0267: MOVWF 36
0268: BSF 03.5
0269: BSF 06.5
026A: MOVLW 00
026B: BCF 03.5
026C: BTFSC 06.5
026D: MOVLW 01
026E: XORWF 36,W
026F: MOVWF 78
0270: BTFSC 78.0
0271: GOTO 274
0272: BCF 35.0
0273: GOTO 275
0274: BSF 35.0
....................
.................... while(!input(CLK)); // ceka na jednicku hodin
0275: BSF 03.5
0276: BSF 06.6
0277: BCF 03.5
0278: BTFSS 06.6
0279: GOTO 275
.................... };
027A: INCF 34,F
027B: GOTO 24C
.................... while(input(CLK));
027C: BSF 03.5
027D: BSF 06.6
027E: BCF 03.5
027F: BTFSC 06.6
0280: GOTO 27C
.................... parity^=input(DATA);
0281: MOVLW 00
0282: BTFSC 35.0
0283: MOVLW 01
0284: MOVWF 36
0285: BSF 03.5
0286: BSF 06.5
0287: MOVLW 00
0288: BCF 03.5
0289: BTFSC 06.5
028A: MOVLW 01
028B: XORWF 36,W
028C: MOVWF 78
028D: BTFSC 78.0
028E: GOTO 291
028F: BCF 35.0
0290: GOTO 292
0291: BSF 35.0
.................... // if (parity)
.................... while(!input(CLK)); // ceka na jednicku hodin
0292: BSF 03.5
0293: BSF 06.6
0294: BCF 03.5
0295: BTFSS 06.6
0296: GOTO 292
.................... while(input(CLK));
0297: BSF 03.5
0298: BSF 06.6
0299: BCF 03.5
029A: BTFSC 06.6
029B: GOTO 297
.................... while(!input(CLK)); // ceka na jednicku hodin
029C: BSF 03.5
029D: BSF 06.6
029E: BCF 03.5
029F: BTFSS 06.6
02A0: GOTO 29C
.................... return (bajt);
02A1: MOVF 33,W
02A2: MOVWF 78
.................... }
02A3: RETLW 00
....................
....................
.................... void read_standard_byte(signed int8 *x,*y,unsigned int8 *tl1,*tl2,*tl3)
.................... {
.................... unsigned int8 st,nd,rd;
....................
.................... st = read_byte();
02A4: CALL 23A
02A5: MOVF 78,W
02A6: MOVWF 30
.................... nd = read_byte();
02A7: CALL 23A
02A8: MOVF 78,W
02A9: MOVWF 31
.................... rd = read_byte();
02AA: CALL 23A
02AB: MOVF 78,W
02AC: MOVWF 32
....................
.................... if ((st & 0b1000) == 0b1000) *x=-nd; else *x=nd;
02AD: MOVF 30,W
02AE: ANDLW 08
02AF: SUBLW 08
02B0: BTFSS 03.2
02B1: GOTO 2B8
02B2: MOVF 2B,W
02B3: MOVWF 04
02B4: MOVF 31,W
02B5: SUBLW 00
02B6: MOVWF 00
02B7: GOTO 2BC
02B8: MOVF 2B,W
02B9: MOVWF 04
02BA: MOVF 31,W
02BB: MOVWF 00
.................... if ((st & 0b10000) == 0b10000) *y=-rd; else *y=rd;
02BC: MOVF 30,W
02BD: ANDLW 10
02BE: SUBLW 10
02BF: BTFSS 03.2
02C0: GOTO 2C7
02C1: MOVF 2C,W
02C2: MOVWF 04
02C3: MOVF 32,W
02C4: SUBLW 00
02C5: MOVWF 00
02C6: GOTO 2CB
02C7: MOVF 2C,W
02C8: MOVWF 04
02C9: MOVF 32,W
02CA: MOVWF 00
....................
.................... *tl1=st & 1;
02CB: MOVF 2D,W
02CC: MOVWF 04
02CD: MOVF 30,W
02CE: ANDLW 01
02CF: MOVWF 00
.................... *tl2=(st >> 1) & 1;
02D0: MOVF 2E,W
02D1: MOVWF 04
02D2: BCF 03.0
02D3: RRF 30,W
02D4: ANDLW 01
02D5: MOVWF 00
.................... *tl3=(st >> 2) & 1;
02D6: MOVF 2F,W
02D7: MOVWF 04
02D8: RRF 30,W
02D9: MOVWF 77
02DA: RRF 77,F
02DB: MOVLW 3F
02DC: ANDWF 77,F
02DD: MOVF 77,W
02DE: ANDLW 01
02DF: MOVWF 00
.................... }
02E0: BCF 0A.3
02E1: GOTO 3A5 (RETURN)
.................... void ps2break()
.................... {
.................... output_low(CLK);
.................... }
.................... void ps2enable()
.................... {
.................... output_float(CLK);
.................... }
....................
....................
....................
....................
.................... void trigger()
.................... {
.................... output_high(TRIGGER_PIN);
.................... delay_us(50);
.................... output_low(TRIGGER_PIN);
.................... }
....................
.................... void main()
.................... {
02E2: CLRF 04
02E3: MOVLW 1F
02E4: ANDWF 03,F
02E5: BSF 03.5
02E6: BCF 1F.4
02E7: BCF 1F.5
02E8: MOVF 1B,W
02E9: ANDLW 80
02EA: MOVWF 1B
02EB: MOVLW 07
02EC: MOVWF 1C
02ED: MOVF 1C,W
02EE: BCF 03.5
02EF: BCF 0D.6
02F0: MOVLW 60
02F1: BSF 03.5
02F2: MOVWF 0F
.................... signed int16 x=0,y=0;
02F3: BCF 03.5
02F4: CLRF 21
02F5: CLRF 22
02F6: CLRF 23
02F7: CLRF 24
.................... signed int8 hodnota,dx,dy;
.................... unsigned int8 tl1,tl2,tl3;
....................
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
02F8: BSF 03.5
02F9: BCF 1F.4
02FA: BCF 1F.5
02FB: MOVF 1B,W
02FC: ANDLW 80
02FD: MOVWF 1B
.................... setup_adc(ADC_OFF);
02FE: BCF 03.5
02FF: BCF 1F.0
.................... setup_spi(FALSE);
0300: BCF 14.5
0301: BSF 03.5
0302: BCF 06.2
0303: BSF 06.1
0304: BCF 06.4
0305: MOVLW 00
0306: BCF 03.5
0307: MOVWF 14
0308: BSF 03.5
0309: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
030A: MOVF 01,W
030B: ANDLW C7
030C: IORLW 08
030D: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
030E: BCF 03.5
030F: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0310: MOVLW 00
0311: MOVWF 78
0312: MOVWF 12
0313: MOVLW 00
0314: BSF 03.5
0315: MOVWF 12
.................... setup_comparator(NC_NC_NC_NC);
0316: MOVLW 07
0317: MOVWF 1C
0318: MOVF 05,W
0319: MOVLW 03
031A: MOVWF 77
031B: DECFSZ 77,F
031C: GOTO 31B
031D: MOVF 1C,W
031E: BCF 03.5
031F: BCF 0D.6
.................... setup_vref(FALSE);
0320: BSF 03.5
0321: CLRF 1D
....................
.................... lcd_init();
0322: BCF 03.5
0323: GOTO 06F
.................... Delay_ms(500);
0324: MOVLW 02
0325: MOVWF 2B
0326: MOVLW FA
0327: MOVWF 34
0328: CALL 033
0329: DECFSZ 2B,F
032A: GOTO 326
....................
.................... send(SET_REMOTE_MODE);
032B: MOVLW F0
032C: MOVWF 2B
032D: CALL 0A9
....................
.................... while (true)
.................... {
.................... LCD_gotoxy(1,1);
032E: MOVLW 01
032F: MOVWF 34
0330: MOVWF 35
0331: CALL 108
.................... printf(lcd_putc,"%X X=%ld Y=%ld TL1=%U TL2=%U TL3=%U",hodnota, x,y,tl1,tl2,tl3);
0332: MOVF 25,W
0333: MOVWF 2B
0334: MOVLW 37
0335: MOVWF 2C
0336: GOTO 14C
0337: MOVLW 20
0338: MOVWF 33
0339: CALL 119
033A: MOVLW 58
033B: MOVWF 33
033C: CALL 119
033D: MOVLW 3D
033E: MOVWF 33
033F: CALL 119
0340: MOVLW 10
0341: MOVWF 04
0342: MOVF 22,W
0343: MOVWF 2C
0344: MOVF 21,W
0345: MOVWF 2B
0346: CALL 16E
0347: MOVLW 20
0348: MOVWF 33
0349: CALL 119
034A: MOVLW 59
034B: MOVWF 33
034C: CALL 119
034D: MOVLW 3D
034E: MOVWF 33
034F: CALL 119
0350: MOVLW 10
0351: MOVWF 04
0352: MOVF 24,W
0353: MOVWF 2C
0354: MOVF 23,W
0355: MOVWF 2B
0356: CALL 16E
0357: MOVLW 0E
0358: MOVWF 2B
0359: MOVF 2B,W
035A: CALL 00C
035B: INCF 2B,F
035C: MOVWF 77
035D: MOVWF 33
035E: CALL 119
035F: MOVLW 13
0360: SUBWF 2B,W
0361: BTFSS 03.2
0362: GOTO 359
0363: MOVF 28,W
0364: MOVWF 2F
0365: MOVLW 18
0366: MOVWF 30
0367: CALL 1ED
0368: MOVLW 03
0369: MOVWF 2C
036A: MOVLW 20
036B: MOVWF 33
036C: CALL 119
036D: DECFSZ 2C,F
036E: GOTO 36A
036F: MOVLW 15
0370: MOVWF 2D
0371: MOVF 2D,W
0372: CALL 00C
0373: INCF 2D,F
0374: MOVWF 77
0375: MOVWF 33
0376: CALL 119
0377: MOVLW 19
0378: SUBWF 2D,W
0379: BTFSS 03.2
037A: GOTO 371
037B: MOVF 29,W
037C: MOVWF 2F
037D: MOVLW 18
037E: MOVWF 30
037F: CALL 1ED
0380: MOVLW 1B
0381: MOVWF 2E
0382: MOVF 2E,W
0383: CALL 00C
0384: INCF 2E,F
0385: MOVWF 77
0386: MOVWF 33
0387: CALL 119
0388: MOVLW 20
0389: SUBWF 2E,W
038A: BTFSS 03.2
038B: GOTO 382
038C: MOVF 2A,W
038D: MOVWF 2F
038E: MOVLW 18
038F: MOVWF 30
0390: CALL 1ED
.................... delay_ms(20);
0391: MOVLW 14
0392: MOVWF 34
0393: CALL 033
.................... send(READ_DATA);
0394: MOVLW EB
0395: MOVWF 2B
0396: CALL 0A9
.................... hodnota=read_byte();
0397: CALL 23A
0398: MOVF 78,W
0399: MOVWF 25
.................... read_standard_byte(&dx,&dy,&tl1,&tl2,&tl3);
039A: MOVLW 26
039B: MOVWF 2B
039C: MOVLW 27
039D: MOVWF 2C
039E: MOVLW 28
039F: MOVWF 2D
03A0: MOVLW 29
03A1: MOVWF 2E
03A2: MOVLW 2A
03A3: MOVWF 2F
03A4: GOTO 2A4
.................... x+=dx;
03A5: CLRF 7A
03A6: MOVF 26,W
03A7: BTFSC 26.7
03A8: DECF 7A,F
03A9: ADDWF 21,F
03AA: BTFSC 03.0
03AB: INCF 22,F
03AC: MOVF 7A,W
03AD: ADDWF 22,F
.................... y+=dy;
03AE: CLRF 7A
03AF: MOVF 27,W
03B0: BTFSC 27.7
03B1: DECF 7A,F
03B2: ADDWF 23,F
03B3: BTFSC 03.0
03B4: INCF 24,F
03B5: MOVF 7A,W
03B6: ADDWF 24,F
.................... }
03B7: GOTO 32E
.................... }
....................
03B8: SLEEP
 
Configuration Fuses:
Word 1: 3F78 NOWDT NOPUT MCLR BROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
Word 2: 3FFF FCMEN IESO
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.PJT
0,0 → 1,39
[PROJECT]
Target=mys.HEX
Development_Mode=
Processor=0x688F
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=mys.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[mys.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=mys.c
 
[Windows]
0=0000 mys.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.c
2=C:\library\CCS\lcd.c
3=D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.h
4=C:\Program Files\PICC\devices\16F88.h
5=C:\library\kaklik\CCS\ps2.c
6=
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.SYM
0,0 → 1,109
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
021-022 main.x
023-024 main.y
025 main.hodnota
026 main.dx
027 main.dy
028 main.tl1
029 main.tl2
02A main.tl3
02B lcd_init.i
02B send.command
02B-02C @PRINTF_LD_278.P1
02B @PRINTF_X_278.P2
02B read_standard_byte.x
02B main.@SCRATCH
02C send.n
02C @PRINTF_X_278.P1
02C read_standard_byte.y
02C lcd_init.@SCRATCH
02C main.@SCRATCH
02D send.parity
02D read_standard_byte.tl1
02D main.@SCRATCH
02D @PRINTF_LD_278.@SCRATCH
02E read_standard_byte.tl2
02E send.@SCRATCH
02E main.@SCRATCH
02E @PRINTF_LD_278.@SCRATCH
02F @PRINTF_U_278.P1
02F read_standard_byte.tl3
02F @PRINTF_LD_278.@SCRATCH
030 read_standard_byte.st
030 @PRINTF_U_278.P1
030 @PRINTF_LD_278.@SCRATCH
031 @DIV88.P1
031 read_standard_byte.nd
031 @PRINTF_LD_278.@SCRATCH
032 @DIV88.P1
032 read_standard_byte.rd
032 @PRINTF_LD_278.@SCRATCH
033 lcd_putc.c
033 read_byte.bajt
033 read_standard_byte.@SCRATCH
033 @DIV88.@SCRATCH
034 read_byte.i
034 lcd_gotoxy.x
034 @delay_ms1.P1
034 read_standard_byte.@SCRATCH
035 lcd_gotoxy.y
035.0 read_byte.parity
036 lcd_gotoxy.Adr
036 read_byte.@SCRATCH
037 lcd_gotoxy.@SCRATCH
038 lcd_send_byte.Adr
039 lcd_send_byte.n
03A lcd_send_nibble.n
03B lcd_send_nibble.@SCRATCH
03C lcd_send_nibble.@SCRATCH
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
09C.6 C1OUT
09C.7 C2OUT
 
0033 @delay_ms1
0004 @const27
0048 lcd_send_nibble
0059 lcd_send_byte
006F lcd_init
0108 lcd_gotoxy
0119 lcd_putc
00A9 send
023A read_byte
02A4 read_standard_byte
02E2 main
000C @const10225
014C @PRINTF_X_278
016E @PRINTF_LD_278
01D8 @DIV88
01ED @PRINTF_U_278
02E2 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.c
D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.h
C:\Program Files\PICC\devices\16F88.h
C:\library\CCS\lcd.c
C:\library\kaklik\CCS\ps2.c
 
Compiler Settings:
Processor: PIC16F88
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.HEX
Symbols: D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.SYM
List: D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.LST
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.sta
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.c
0,0 → 1,58
#include "D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.h"
 
#define LCD_RS PIN_A0 // rizeni registru LCD displeje
#define LCD_E PIN_A1 // enable LCD displeje
#define LCD_DATA_LSB PIN_B0 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
#include "C:\library\CCS\lcd.c" // modul pro ovladani LCD
 
#define TRIGGER_PIN PIN_B4
 
#DEFINE DATA PIN_B5 // drat DATA
#DEFINE CLK PIN_B6 // hodiny CLK
#include "C:\library\kaklik\CCS\ps2.c" // modul pro SW ovladani PS2
 
 
 
void trigger()
{
output_high(TRIGGER_PIN);
delay_us(50);
output_low(TRIGGER_PIN);
}
 
void main()
{
signed int16 x=0,y=0;
signed int8 hodnota,dx,dy;
unsigned int8 tl1,tl2,tl3;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(FALSE);
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);
 
lcd_init();
Delay_ms(200);
ps2send(RESET); // resetuje mys
read_byte(); // prijme 0xFA
read_byte(); // 0xAA self-test passed
read_byte(); // mouse ID
Delay_ms(200);
ps2send(SET_REMOTE_MODE);
 
while (true)
{
LCD_gotoxy(1,1);
printf(lcd_putc,"%X X=%ld Y=%ld TL1=%U TL2=%U TL3=%U",hodnota, x,y,tl1,tl2,tl3);
delay_ms(20);
send(READ_DATA);
hodnota=read_byte();
read_standard_byte(&dx,&dy,&tl1,&tl2,&tl3);
x+=dx;
y+=dy;
}
}
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.cof
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
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.h
0,0 → 1,5
#include <16F88.h>
#device adc=8
#fuses NOWDT,INTRC_IO, NOPUT, MCLR, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
#use delay(clock=4000000)
 
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.sta
0,0 → 1,45
 
ROM used: 953 (23%)
953 (23%) including unused fragments
 
1 Average locations per line
7 Average locations per statement
 
RAM used: 19 (11%) at main() level
33 (19%) worst case
 
Lines Stmts % Files
----- ----- --- -----
55 24 17 D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.c
6 0 0 D:\KAKLIK\programy\PIC_C\mereni\PS2mys\PIC16F88\mys.h
275 0 0 C:\Program Files\PICC\devices\16F88.h
312 47 29 C:\library\CCS\lcd.c
113 67 32 C:\library\kaklik\CCS\ps2.c
----- -----
1522 276 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 2 1 @delay_ms1
0 8 1 0 @const27
0 17 2 3 lcd_send_nibble
0 22 2 2 lcd_send_byte
0 58 6 2 lcd_init
0 17 2 4 lcd_gotoxy
0 51 5 1 lcd_putc
0 95 10 4 send
0 106 11 4 read_byte
0 62 7 10 read_standard_byte
0 215 23 14 main
0 39 4 0 @const10225
0 34 4 2 @PRINTF_X_278
0 106 11 8 @PRINTF_LD_278
0 21 2 3 @DIV88
0 77 8 2 @PRINTF_U_278
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 949 1095
00800-00FFF 0 2048
 
/programy/C/PIC/mereni/PS2mys/PIC16F88/mys.tre
0,0 → 1,668
ÀÄmys
ÀÄmain 0/215 Ram=14
ÃÄ??0??
ÃÄlcd_init 0/58 Ram=2
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@const27 0/8 Ram=0
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄsend 0/95 Ram=4
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_X_278 0/34 Ram=2
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_LD_278 0/106 Ram=8
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_LD_278 0/106 Ram=8
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@const10225 0/39 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_U_278 0/77 Ram=2
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@const10225 0/39 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_U_278 0/77 Ram=2
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@const10225 0/39 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_U_278 0/77 Ram=2
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄsend 0/95 Ram=4
ÃÄread_byte 0/106 Ram=4
ÀÄread_standard_byte 0/62 Ram=10
ÃÄread_byte 0/106 Ram=4
ÃÄread_byte 0/106 Ram=4
ÀÄread_byte 0/106 Ram=4
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.BAK
0,0 → 1,19
#include <16F88.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPUT //No Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode enabled
 
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B5,bits=8)
 
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.PJT
0,0 → 1,40
[PROJECT]
Target=geiger.HEX
Development_Mode=2
Processor=0x688F
ToolSuite=CCS
 
[Directories]
Include=
Library=
LinkerScript=
 
[Target Data]
FileList=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[geiger.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
 
[Windows]
0=0000 D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
2=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h
3=C:\Program Files\PICC\devices\16F88.h
4=
[Units]
Count=1
1=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c (main)
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.c
0,0 → 1,27
#include "D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h"
 
 
void main()
{
unsigned int16 n;
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
setup_timer_1(T1_DISABLED|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_comparator(A0_A2_A1_A2_OUT_ON_A3_A4);
setup_vref(VREF_LOW|1|VREF_A2);
setup_oscillator(False);
n=0;
set_timer0(0);
While(true)
{
printf("%Lu0, %u\n\r", n++, get_timer0());
set_timer0(0);
Delay_ms(10000);
}
}
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.cof
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
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.h
0,0 → 1,19
#include <16F88.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPUT //No Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode disabled
 
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B5,bits=8)
 
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.hex
0,0 → 1,47
:1000000000308A00E12800008316861183128611D1
:100010000830F800000000000000F8171E28F81350
:10002000AE0C03188615031C861178171E2878134A
:10003000F80B10280000000000008615A73084008F
:10004000840B202800000000F81B0F28781B1728BD
:1000500000340408AD00270EF038A900A907E23EDD
:10006000AA00323EAC0027080F39AA07AA07AC073E
:10007000E93EAB00AB07AB07260E0F39AB07AC0769
:10008000AB0DAC0DAC09AC0D26080F39AC07A90DB2
:100090000730A8000A30AC07AB03031C4B28AB07A2
:1000A000AA03031C4F28AA07A903031C5328A90766
:1000B000A803031C57282830840007302D052D1372
:1000C00084072C30040203192D170008F700031DC4
:1000D00071282D1B71282D1A7D28AD19712820300B
:1000E0007428AD152D123030F707A7010408A600BB
:1000F0007708AE00042026088400840A2D1F61289A
:100100008A113C292908F801280203188A2828089E
:10011000F7009628F7010830AA00A80DF70D290866
:1001200077020318F700F80DAA0B8D280034780821
:100130002608A8006430A90082207708A600780865
:100140003030031DAA28A71CB128A719B128271AE7
:100150002030AD28A71127122714F8077808AE0021
:1001600004202608A8000A30A90082207708A600EB
:1001700078083030031DC228A719C628271CC628B6
:10018000271A2030F8077808AE0004203030A60780
:100190002608AE0004208A114A2924308400000871
:1001A0000319DF280630F800F701F70BD528F80B04
:1001B000D4287B30F700F70BDB28800BD2288A117C
:1001C000562984011F3083058316861183128615F4
:1001D00083161F129F121B0880399B0007309C005A
:1001E0001F129F121B0880399B0083121F1094124C
:1001F00083160611861406120030831294008316AB
:1002000094000108C739383881008312900100300A
:10021000F8009200003083169200061483129701B2
:100220009701063083169C0005080738E7398500DA
:100230001030F700F70B1A2900001C0883120D1369
:10024000E13083169D0005158F010F088312A2016E
:10025000A10181012208FA002108A10A0319A20ABA
:10026000A3007A08A4000108A50010308400240827
:10027000A7002308A60029283030AE0004202C3027
:10028000AE0004202030AE0004202508A6001B305C
:10029000A70097280A30AE0004200D30AE000420DD
:1002A00081012830A300FA30A400CD28A30B5329E4
:0402B0002A29630094
:04400E002A3FFC3F0A
:00000001FF
;PIC16F88
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.lst
0,0 → 1,250
CCS PCM C Compiler, Version 3.245, 27853 10-VI-06 10:23
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.lst
 
ROM used: 346 words (8%)
Largest free fragment is 2048
RAM used: 10 (6%) at main() level
19 (11%) worst case
Stack: 2 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 0E1
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES HS //High speed Osc (> 4mhz)
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES MCLR //Master Clear pin enabled
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOFCMEN //Fail-safe clock monitor disabled
.................... #FUSES NOIESO //Internal External Switch Over mode disabled
....................
.................... #use delay(clock=20000000)
00CD: MOVLW 24
00CE: MOVWF 04
00CF: MOVF 00,W
00D0: BTFSC 03.2
00D1: GOTO 0DF
00D2: MOVLW 06
00D3: MOVWF 78
00D4: CLRF 77
00D5: DECFSZ 77,F
00D6: GOTO 0D5
00D7: DECFSZ 78,F
00D8: GOTO 0D4
00D9: MOVLW 7B
00DA: MOVWF 77
00DB: DECFSZ 77,F
00DC: GOTO 0DB
00DD: DECFSZ 00,F
00DE: GOTO 0D2
00DF: BCF 0A.3
00E0: GOTO 156 (RETURN)
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B5,bits=8)
*
0004: BSF 03.5
0005: BCF 06.3
0006: BCF 03.5
0007: BCF 06.3
0008: MOVLW 08
0009: MOVWF 78
000A: NOP
000B: NOP
000C: NOP
000D: BSF 78.7
000E: GOTO 01E
000F: BCF 78.7
0010: RRF 2E,F
0011: BTFSC 03.0
0012: BSF 06.3
0013: BTFSS 03.0
0014: BCF 06.3
0015: BSF 78.6
0016: GOTO 01E
0017: BCF 78.6
0018: DECFSZ 78,F
0019: GOTO 010
001A: NOP
001B: NOP
001C: NOP
001D: BSF 06.3
001E: MOVLW A7
001F: MOVWF 04
0020: DECFSZ 04,F
0021: GOTO 020
0022: NOP
0023: NOP
0024: BTFSC 78.7
0025: GOTO 00F
0026: BTFSC 78.6
0027: GOTO 017
0028: RETLW 00
....................
....................
....................
....................
.................... void main()
.................... {
*
00E1: CLRF 04
00E2: MOVLW 1F
00E3: ANDWF 03,F
00E4: BSF 03.5
00E5: BCF 06.3
00E6: BCF 03.5
00E7: BSF 06.3
00E8: BSF 03.5
00E9: BCF 1F.4
00EA: BCF 1F.5
00EB: MOVF 1B,W
00EC: ANDLW 80
00ED: MOVWF 1B
00EE: MOVLW 07
00EF: MOVWF 1C
.................... unsigned int16 n;
....................
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
00F0: BCF 1F.4
00F1: BCF 1F.5
00F2: MOVF 1B,W
00F3: ANDLW 80
00F4: MOVWF 1B
.................... setup_adc(ADC_OFF);
00F5: BCF 03.5
00F6: BCF 1F.0
.................... setup_spi(FALSE);
00F7: BCF 14.5
00F8: BSF 03.5
00F9: BCF 06.2
00FA: BSF 06.1
00FB: BCF 06.4
00FC: MOVLW 00
00FD: BCF 03.5
00FE: MOVWF 14
00FF: BSF 03.5
0100: MOVWF 14
.................... setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
0101: MOVF 01,W
0102: ANDLW C7
0103: IORLW 38
0104: MOVWF 01
.................... setup_timer_1(T1_DISABLED|T1_DIV_BY_1);
0105: BCF 03.5
0106: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0107: MOVLW 00
0108: MOVWF 78
0109: MOVWF 12
010A: MOVLW 00
010B: BSF 03.5
010C: MOVWF 12
.................... setup_ccp1(CCP_OFF);
010D: BSF 06.0
010E: BCF 03.5
010F: CLRF 17
0110: CLRF 17
.................... setup_comparator(A0_A2_A1_A2_OUT_ON_A3_A4);
0111: MOVLW 06
0112: BSF 03.5
0113: MOVWF 1C
0114: MOVF 05,W
0115: IORLW 07
0116: ANDLW E7
0117: MOVWF 05
0118: MOVLW 10
0119: MOVWF 77
011A: DECFSZ 77,F
011B: GOTO 11A
011C: NOP
011D: MOVF 1C,W
011E: BCF 03.5
011F: BCF 0D.6
.................... setup_vref(VREF_LOW|1|VREF_A2);
0120: MOVLW E1
0121: BSF 03.5
0122: MOVWF 1D
0123: BSF 05.2
.................... setup_oscillator(False);
0124: CLRF 0F
0125: MOVF 0F,W
....................
.................... n=0;
0126: BCF 03.5
0127: CLRF 22
0128: CLRF 21
.................... set_timer0(0);
0129: CLRF 01
.................... While(true)
.................... {
.................... printf("%Lu0, %u\n\r", n++, get_timer0());
012A: MOVF 22,W
012B: MOVWF 7A
012C: MOVF 21,W
012D: INCF 21,F
012E: BTFSC 03.2
012F: INCF 22,F
0130: MOVWF 23
0131: MOVF 7A,W
0132: MOVWF 24
0133: MOVF 01,W
0134: MOVWF 25
0135: MOVLW 10
0136: MOVWF 04
0137: MOVF 24,W
0138: MOVWF 27
0139: MOVF 23,W
013A: MOVWF 26
013B: GOTO 029
013C: MOVLW 30
013D: MOVWF 2E
013E: CALL 004
013F: MOVLW 2C
0140: MOVWF 2E
0141: CALL 004
0142: MOVLW 20
0143: MOVWF 2E
0144: CALL 004
0145: MOVF 25,W
0146: MOVWF 26
0147: MOVLW 1B
0148: MOVWF 27
0149: GOTO 097
014A: MOVLW 0A
014B: MOVWF 2E
014C: CALL 004
014D: MOVLW 0D
014E: MOVWF 2E
014F: CALL 004
.................... set_timer0(0);
0150: CLRF 01
.................... Delay_ms(10000);
0151: MOVLW 28
0152: MOVWF 23
0153: MOVLW FA
0154: MOVWF 24
0155: GOTO 0CD
0156: DECFSZ 23,F
0157: GOTO 153
.................... }
0158: GOTO 12A
.................... }
0159: SLEEP
 
Configuration Fuses:
Word 1: 3F2A HS NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT
Word 2: 3FFC NOFCMEN NOIESO
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.sta
0,0 → 1,33
 
ROM used: 346 (8%)
346 (8%) including unused fragments
 
1 Average locations per line
20 Average locations per statement
 
RAM used: 10 (6%) at main() level
19 (11%) worst case
 
Lines Stmts % Files
----- ----- --- -----
28 17 100 D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
20 0 0 D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h
279 0 0 C:\Program Files\PICC\devices\16F88.h
----- -----
654 34 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 20 6 1 @delay_ms1
0 37 11 1 @PUTCHAR_1_
0 121 35 5 main
0 89 26 8 @PRINTF_LU_9600_51_53
0 21 6 3 @DIV88
0 54 16 2 @PRINTF_U_9600_51_53
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 342 1702
00800-00FFF 0 2048
 
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.sym
0,0 → 1,61
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
021-022 main.n
023 main.@SCRATCH
024 @delay_ms1.P1
024 main.@SCRATCH
025 main.@SCRATCH
026-027 @PRINTF_LU_9600_51_53.P1
026 @PRINTF_U_9600_51_53.P2
027 @PRINTF_U_9600_51_53.P1
028 @DIV88.P1
028 @PRINTF_LU_9600_51_53.@SCRATCH
029 @DIV88.P1
029 @PRINTF_LU_9600_51_53.@SCRATCH
02A @PRINTF_LU_9600_51_53.@SCRATCH
02A @DIV88.@SCRATCH
02B @PRINTF_LU_9600_51_53.@SCRATCH
02C @PRINTF_LU_9600_51_53.@SCRATCH
02D @PRINTF_LU_9600_51_53.@SCRATCH
02E @PUTCHAR_1_.P1
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
09C.6 C1OUT
09C.7 C2OUT
 
00CD @delay_ms1
0004 @PUTCHAR_1_
00E1 main
0029 @PRINTF_LU_9600_51_53
0082 @DIV88
0097 @PRINTF_U_9600_51_53
00E1 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h
C:\Program Files\PICC\devices\16F88.h
 
Units:
D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c (main)
 
Compiler Settings:
Processor: PIC16F88
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.hex
Symbols: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.sym
List: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.lst
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.sta
/programy/C/PIC/mereni/geiger/bez_GPS/geiger.tre
0,0 → 1,17
ÀÄgeiger
ÀÄmain 0/121 Ram=5
ÃÄ??0??
ÃÄ@PRINTF_LU_9600_51_53 0/89 Ram=8
³ ÀÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PRINTF_U_9600_51_53 0/54 Ram=2
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/37 Ram=1
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/37 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÀÄ@delay_ms1 0/20 Ram=1
/programy/C/PIC/mereni/geiger/geiger.BAK
0,0 → 1,19
#include <16F88.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPUT //No Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode enabled
 
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B5,bits=8)
 
/programy/C/PIC/mereni/geiger/geiger.PJT
0,0 → 1,40
[PROJECT]
Target=geiger.HEX
Development_Mode=2
Processor=0x688F
ToolSuite=CCS
 
[Directories]
Include=
Library=
LinkerScript=
 
[Target Data]
FileList=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[geiger.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
 
[Windows]
0=0000 D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
2=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h
3=C:\Program Files\PICC\devices\16F88.h
4=
[Units]
Count=1
1=D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c (main)
/programy/C/PIC/mereni/geiger/geiger.c
0,0 → 1,27
#include "D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h"
 
 
void main()
{
unsigned int16 n;
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
setup_timer_1(T1_DISABLED|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_comparator(A0_A2_A1_A2_OUT_ON_A3_A4);
setup_vref(VREF_LOW|1|VREF_A2);
setup_oscillator(False);
n=0;
set_timer0(0);
While(true)
{
printf("%Lu0, %u\n\r", n++, get_timer0());
set_timer0(0);
Delay_ms(10000);
}
}
/programy/C/PIC/mereni/geiger/geiger.cof
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
/programy/C/PIC/mereni/geiger/geiger.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/mereni/geiger/geiger.h
0,0 → 1,19
#include <16F88.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPUT //No Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode disabled
 
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B5,bits=8)
 
/programy/C/PIC/mereni/geiger/geiger.hex
0,0 → 1,47
:1000000000308A00E12800008316861183128611D1
:100010000830F800000000000000F8171E28F81350
:10002000AE0C03188615031C861178171E2878134A
:10003000F80B10280000000000008615A73084008F
:10004000840B202800000000F81B0F28781B1728BD
:1000500000340408AD00270EF038A900A907E23EDD
:10006000AA00323EAC0027080F39AA07AA07AC073E
:10007000E93EAB00AB07AB07260E0F39AB07AC0769
:10008000AB0DAC0DAC09AC0D26080F39AC07A90DB2
:100090000730A8000A30AC07AB03031C4B28AB07A2
:1000A000AA03031C4F28AA07A903031C5328A90766
:1000B000A803031C57282830840007302D052D1372
:1000C00084072C30040203192D170008F700031DC4
:1000D00071282D1B71282D1A7D28AD19712820300B
:1000E0007428AD152D123030F707A7010408A600BB
:1000F0007708AE00042026088400840A2D1F61289A
:100100008A113C292908F801280203188A2828089E
:10011000F7009628F7010830AA00A80DF70D290866
:1001200077020318F700F80DAA0B8D280034780821
:100130002608A8006430A90082207708A600780865
:100140003030031DAA28A71CB128A719B128271AE7
:100150002030AD28A71127122714F8077808AE0021
:1001600004202608A8000A30A90082207708A600EB
:1001700078083030031DC228A719C628271CC628B6
:10018000271A2030F8077808AE0004203030A60780
:100190002608AE0004208A114A2924308400000871
:1001A0000319DF280630F800F701F70BD528F80B04
:1001B000D4287B30F700F70BDB28800BD2288A117C
:1001C000562984011F3083058316861183128615F4
:1001D00083161F129F121B0880399B0007309C005A
:1001E0001F129F121B0880399B0083121F1094124C
:1001F00083160611861406120030831294008316AB
:1002000094000108C739383881008312900100300A
:10021000F8009200003083169200061483129701B2
:100220009701063083169C0005080738E7398500DA
:100230001030F700F70B1A2900001C0883120D1369
:10024000E13083169D0005158F010F088312A2016E
:10025000A10181012208FA002108A10A0319A20ABA
:10026000A3007A08A4000108A50010308400240827
:10027000A7002308A60029283030AE0004202C3027
:10028000AE0004202030AE0004202508A6001B305C
:10029000A70097280A30AE0004200D30AE000420DD
:1002A00081012830A300FA30A400CD28A30B5329E4
:0402B0002A29630094
:04400E002A3FFC3F0A
:00000001FF
;PIC16F88
/programy/C/PIC/mereni/geiger/geiger.lst
0,0 → 1,250
CCS PCM C Compiler, Version 3.245, 27853 10-VI-06 10:23
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.lst
 
ROM used: 346 words (8%)
Largest free fragment is 2048
RAM used: 10 (6%) at main() level
19 (11%) worst case
Stack: 2 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 0E1
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES HS //High speed Osc (> 4mhz)
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES MCLR //Master Clear pin enabled
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOFCMEN //Fail-safe clock monitor disabled
.................... #FUSES NOIESO //Internal External Switch Over mode disabled
....................
.................... #use delay(clock=20000000)
00CD: MOVLW 24
00CE: MOVWF 04
00CF: MOVF 00,W
00D0: BTFSC 03.2
00D1: GOTO 0DF
00D2: MOVLW 06
00D3: MOVWF 78
00D4: CLRF 77
00D5: DECFSZ 77,F
00D6: GOTO 0D5
00D7: DECFSZ 78,F
00D8: GOTO 0D4
00D9: MOVLW 7B
00DA: MOVWF 77
00DB: DECFSZ 77,F
00DC: GOTO 0DB
00DD: DECFSZ 00,F
00DE: GOTO 0D2
00DF: BCF 0A.3
00E0: GOTO 156 (RETURN)
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B5,bits=8)
*
0004: BSF 03.5
0005: BCF 06.3
0006: BCF 03.5
0007: BCF 06.3
0008: MOVLW 08
0009: MOVWF 78
000A: NOP
000B: NOP
000C: NOP
000D: BSF 78.7
000E: GOTO 01E
000F: BCF 78.7
0010: RRF 2E,F
0011: BTFSC 03.0
0012: BSF 06.3
0013: BTFSS 03.0
0014: BCF 06.3
0015: BSF 78.6
0016: GOTO 01E
0017: BCF 78.6
0018: DECFSZ 78,F
0019: GOTO 010
001A: NOP
001B: NOP
001C: NOP
001D: BSF 06.3
001E: MOVLW A7
001F: MOVWF 04
0020: DECFSZ 04,F
0021: GOTO 020
0022: NOP
0023: NOP
0024: BTFSC 78.7
0025: GOTO 00F
0026: BTFSC 78.6
0027: GOTO 017
0028: RETLW 00
....................
....................
....................
....................
.................... void main()
.................... {
*
00E1: CLRF 04
00E2: MOVLW 1F
00E3: ANDWF 03,F
00E4: BSF 03.5
00E5: BCF 06.3
00E6: BCF 03.5
00E7: BSF 06.3
00E8: BSF 03.5
00E9: BCF 1F.4
00EA: BCF 1F.5
00EB: MOVF 1B,W
00EC: ANDLW 80
00ED: MOVWF 1B
00EE: MOVLW 07
00EF: MOVWF 1C
.................... unsigned int16 n;
....................
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
00F0: BCF 1F.4
00F1: BCF 1F.5
00F2: MOVF 1B,W
00F3: ANDLW 80
00F4: MOVWF 1B
.................... setup_adc(ADC_OFF);
00F5: BCF 03.5
00F6: BCF 1F.0
.................... setup_spi(FALSE);
00F7: BCF 14.5
00F8: BSF 03.5
00F9: BCF 06.2
00FA: BSF 06.1
00FB: BCF 06.4
00FC: MOVLW 00
00FD: BCF 03.5
00FE: MOVWF 14
00FF: BSF 03.5
0100: MOVWF 14
.................... setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
0101: MOVF 01,W
0102: ANDLW C7
0103: IORLW 38
0104: MOVWF 01
.................... setup_timer_1(T1_DISABLED|T1_DIV_BY_1);
0105: BCF 03.5
0106: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0107: MOVLW 00
0108: MOVWF 78
0109: MOVWF 12
010A: MOVLW 00
010B: BSF 03.5
010C: MOVWF 12
.................... setup_ccp1(CCP_OFF);
010D: BSF 06.0
010E: BCF 03.5
010F: CLRF 17
0110: CLRF 17
.................... setup_comparator(A0_A2_A1_A2_OUT_ON_A3_A4);
0111: MOVLW 06
0112: BSF 03.5
0113: MOVWF 1C
0114: MOVF 05,W
0115: IORLW 07
0116: ANDLW E7
0117: MOVWF 05
0118: MOVLW 10
0119: MOVWF 77
011A: DECFSZ 77,F
011B: GOTO 11A
011C: NOP
011D: MOVF 1C,W
011E: BCF 03.5
011F: BCF 0D.6
.................... setup_vref(VREF_LOW|1|VREF_A2);
0120: MOVLW E1
0121: BSF 03.5
0122: MOVWF 1D
0123: BSF 05.2
.................... setup_oscillator(False);
0124: CLRF 0F
0125: MOVF 0F,W
....................
.................... n=0;
0126: BCF 03.5
0127: CLRF 22
0128: CLRF 21
.................... set_timer0(0);
0129: CLRF 01
.................... While(true)
.................... {
.................... printf("%Lu0, %u\n\r", n++, get_timer0());
012A: MOVF 22,W
012B: MOVWF 7A
012C: MOVF 21,W
012D: INCF 21,F
012E: BTFSC 03.2
012F: INCF 22,F
0130: MOVWF 23
0131: MOVF 7A,W
0132: MOVWF 24
0133: MOVF 01,W
0134: MOVWF 25
0135: MOVLW 10
0136: MOVWF 04
0137: MOVF 24,W
0138: MOVWF 27
0139: MOVF 23,W
013A: MOVWF 26
013B: GOTO 029
013C: MOVLW 30
013D: MOVWF 2E
013E: CALL 004
013F: MOVLW 2C
0140: MOVWF 2E
0141: CALL 004
0142: MOVLW 20
0143: MOVWF 2E
0144: CALL 004
0145: MOVF 25,W
0146: MOVWF 26
0147: MOVLW 1B
0148: MOVWF 27
0149: GOTO 097
014A: MOVLW 0A
014B: MOVWF 2E
014C: CALL 004
014D: MOVLW 0D
014E: MOVWF 2E
014F: CALL 004
.................... set_timer0(0);
0150: CLRF 01
.................... Delay_ms(10000);
0151: MOVLW 28
0152: MOVWF 23
0153: MOVLW FA
0154: MOVWF 24
0155: GOTO 0CD
0156: DECFSZ 23,F
0157: GOTO 153
.................... }
0158: GOTO 12A
.................... }
0159: SLEEP
 
Configuration Fuses:
Word 1: 3F2A HS NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT
Word 2: 3FFC NOFCMEN NOIESO
/programy/C/PIC/mereni/geiger/geiger.sta
0,0 → 1,33
 
ROM used: 346 (8%)
346 (8%) including unused fragments
 
1 Average locations per line
20 Average locations per statement
 
RAM used: 10 (6%) at main() level
19 (11%) worst case
 
Lines Stmts % Files
----- ----- --- -----
28 17 100 D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
20 0 0 D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h
279 0 0 C:\Program Files\PICC\devices\16F88.h
----- -----
654 34 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 20 6 1 @delay_ms1
0 37 11 1 @PUTCHAR_1_
0 121 35 5 main
0 89 26 8 @PRINTF_LU_9600_51_53
0 21 6 3 @DIV88
0 54 16 2 @PRINTF_U_9600_51_53
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 342 1702
00800-00FFF 0 2048
 
/programy/C/PIC/mereni/geiger/geiger.sym
0,0 → 1,61
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
021-022 main.n
023 main.@SCRATCH
024 @delay_ms1.P1
024 main.@SCRATCH
025 main.@SCRATCH
026-027 @PRINTF_LU_9600_51_53.P1
026 @PRINTF_U_9600_51_53.P2
027 @PRINTF_U_9600_51_53.P1
028 @DIV88.P1
028 @PRINTF_LU_9600_51_53.@SCRATCH
029 @DIV88.P1
029 @PRINTF_LU_9600_51_53.@SCRATCH
02A @PRINTF_LU_9600_51_53.@SCRATCH
02A @DIV88.@SCRATCH
02B @PRINTF_LU_9600_51_53.@SCRATCH
02C @PRINTF_LU_9600_51_53.@SCRATCH
02D @PRINTF_LU_9600_51_53.@SCRATCH
02E @PUTCHAR_1_.P1
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
09C.6 C1OUT
09C.7 C2OUT
 
00CD @delay_ms1
0004 @PUTCHAR_1_
00E1 main
0029 @PRINTF_LU_9600_51_53
0082 @DIV88
0097 @PRINTF_U_9600_51_53
00E1 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c
D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.h
C:\Program Files\PICC\devices\16F88.h
 
Units:
D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.c (main)
 
Compiler Settings:
Processor: PIC16F88
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.hex
Symbols: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.sym
List: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.lst
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\geiger\geiger.sta
/programy/C/PIC/mereni/geiger/geiger.tre
0,0 → 1,17
ÀÄgeiger
ÀÄmain 0/121 Ram=5
ÃÄ??0??
ÃÄ@PRINTF_LU_9600_51_53 0/89 Ram=8
³ ÀÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PRINTF_U_9600_51_53 0/54 Ram=2
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/37 Ram=1
³ ÃÄ@DIV88 0/21 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/37 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÃÄ@PUTCHAR_1_ 0/37 Ram=1
ÀÄ@delay_ms1 0/20 Ram=1
/programy/C/PIC/mereni/geiger/nmea.c
0,0 → 1,1434
// Change the following to change the clock frequency
#define CRYSTAL_FREQ 16000000
// Change the following to change between 16 or 20 column display
#define DISPLAY_COLS 20
// Speed units are "1" (nautical knots), "2" (metric kph), or "3" (statute mph)
#define SPEED_UNITS 1
 
/****************************************************************************
GPS18.c
 
This program receives NMEA-0183 data from a GPS and displays it.
Meant for large display version still in 16F876.
Three buttons
Automicaly resets if main loop stops (not the best solution, still don't know why it's stopping)
 
Next: don't display GPS screens unless GPS is active
detect display needing reset
preset data eeprom for first-time operation
don't display init stuff if reseting from main loop
 
 
 
+5 +5+5
| | |
20 15 2
---------- ----------
~SerIn -----18-| |-24-----11-|DB4 A Vdd |
| |-25-----12-|DB5 |
ADC0 ------2-| |-26-----13-|DB6 |
ADC1 ------3-| 16F876 |-27-----14-|DB7 Vo| 3--
ADC2 ------5-| | | LCD | |
| |-14------6-|EN | |
XTAL--9-| |-15------4-|R/S | |
XTAL-10-| |-28-FET-16-|K | |
| | | RW Vss | |
BUTTON 1---21-| | ---------- |
BUTTON 2---22-| | 1 5 |
BUTTON 3---23-| | | | |
| | Gnd Gnd |
| | |
| |-11----------R/C-----------
| |
| |
----------
8 19
| |
Gnd Gnd
 
***************************************************************************/
#case
#include <16F876.h>
#include <jonsinc.h>
#device = *=16 ADC=10 /* allow RAM addresses over 255 */
 
#if ( ( CRYSTAL_FREQ < 4000000) || ( CRYSTAL_FREQ > 20000000 ) )
#error "CRYSTAL FREQ" not defined to between 8000000 and 20000000
#endif
#if ( ( DISPLAY_COLS != 16 ) && ( DISPLAY_COLS != 20 ) )
#error "DISPLAY COLS" not defined to 16 or 20
#endif
 
// RMC_TIME = 1 per clock megahertz, rounded
#define RMC_TIME CRYSTAL_FREQ/1000000
 
#define LCD_D0 PIN_B3
#define LCD_D1 PIN_B4
#define LCD_D2 PIN_B5
#define LCD_D3 PIN_B6
#define LCD_EN PIN_C3
#define LCD_RS PIN_C4
#define RX_IN PIN_C7
#define BUTTON_1 PIN_B0
#define BUTTON_2 PIN_B1
#define BUTTON_3 PIN_B2
#define LCD_BACKLITE PIN_B7
#define LINE_1 0x00
#define LINE_2 0x40
#if DISPLAY_COLS == 20
#define LINE_3 0x14
#define LINE_4 0x54
#endif
#if DISPLAY_COLS == 16
#define LINE_3 0x10
#define LINE_4 0x50
#endif
#define CLEAR_DISP 0x01
#define EOF 0x00
#define COMMA ','
#define CR 13
#define SPACE ' '
#define PERIOD '.'
#define DEGREE 0xdf
#define DOLLAR '$'
#define NULL 0
#define GPRMC_CODE 75
#define GPRMB_CODE 74
#define RX_BUFFER_SIZE 70
#define POSITION_SCREEN 1
#define WAYPOINT_SCREEN 2
#define BATTERY_SCREEN 3
#define HIDDEN_RMC 5
#define WARNING_MSG 0
#define NODATA_MSG 1
#define ACTIVITY_SYMBOL 0xFF
#define MAX_VOLTS 15
#define EEPROM_CONTRAST 0
#define EEPROM_INITIAL 1
 
/* Set the following define to "YES" to display XOR'ed GPS sentence code */
/* such as GPRMC and the display will read out the value of 74. */
#define GET_GPS_CODE NO
 
#separate void Display ( void );
#separate void LCD_Init ( void );
#separate void LCD_SetPosition ( unsigned int cX );
#separate void LCD_PutChar ( unsigned int cX );
#separate void LCD_PutCmd ( unsigned int cX );
#separate void LCD_PulseEnable ( void );
#separate void LCD_SetData ( unsigned int cX );
#separate void SkipField ( char cCnt );
#separate char GetField ( void );
#separate void InitRxBuffer ( char cCode );
#separate char GetRxChar ( void );
#separate void DisplayLatLon ( void );
#separate void DisplayWaypoint ( void );
#separate void DisplayLatitude ( char cLine );
#separate void DisplayLongitude ( char cLine );
#separate void DisplayHeading ( char cLine );
#separate void DisplaySpeed ( char cLine );
#separate void DisplaySteer ( char cLine, char cX );
#separate void DisplayWaypointName ( char cLine, char cX );
#separate void DisplayDistance ( char cLine, char cX );
#separate void DisplayBearing ( char cLine, char cX );
#separate void GetUtcAndMagVar ( void );
#separate long TrueToMag ( long iH );
#separate long FieldFiveToLong ( void );
#separate void DisplayAnalog ( void );
#separate void DisplayScaledVoltage ( long iV, char cScale );
#separate void DisplayArrival ( char cLine );
#separate void DisplayMessage ( char cMsgNum );
#separate void DisplayTemplateLatLon ( void );
#separate void DisplayTemplateWaypoint ( void );
#separate void DisplayTemplateAnalog ( void );
#separate void Delay5mS ( char cCnt );
 
#fuses HS, NOPROTECT, PUT, NOWDT, BROWNOUT, NOLVP, NOCPD
#use standard_io ( A )
#use standard_io ( B )
#use standard_io ( C )
#use delay ( clock = CRYSTAL_FREQ )
#use rs232 ( baud=4800, xmit=PIN_C6, rcv=PIN_C7, ERRORS ) // XMIT must be assigned to enable hardward USART
#priority RDA, RTCC, EXT
 
static char cC [ 10 ]; // local buffer
static char cTimeOut;
static char cRxBuffer [ RX_BUFFER_SIZE ]; // Fifo
static char cRxByteCnt; // Number of bytes in the recv fifo
static char *cRxBufferWritePtr; // Pointers for the Rx buffer
static char *cRxBufferReadPtr;
static char cRxIsrState, cRxMsgTypeReceived, cRxMsgTypeDesired;
static char cRxMsgReady, cReceiveFlag;
static long iVar, iLastRange, iTimeOut;
static char cVarDir, cScreenChanged, cAdcDone;
static char cButtonPressed, cSkip, cButtonCount;
static char cScreen, cSavedScreen, cRmcTimer1, cRmcTimer2;
static char cToFrom [ 5 ], cIndicator, cIllumination, cRxErrorFlag;
static char cDone, cContrast;
 
/*******************************************************************/
#int_ad
void AdcInterrupt ( void )
{
/* Gets here when ADC is done conversion, sets flag */
cAdcDone = YES;
}
 
#int_timer1
void Timer1Interrupt ( void )
{
/* Periodic RMC data timer, gets here every 204mS */
/* This routine forces RMC to run every 10 minutes to update */
/* magnetic variation */
if ( cRmcTimer1-- == 0 )
{
cRmcTimer1 = 255; // 52 seconds @ 10.240MHz
if ( cRmcTimer2-- == 0 )
{
cRmcTimer2 = RMC_TIME; // triggers every 10 minutes
cSavedScreen = cScreen; // save current screen type
cScreen = HIDDEN_RMC; // force RMC to run
}
}
}
 
#int_rtcc
void Timer0Interrupt ( void )
{
// Gets here every 16.4mS at 8MHz, 8.2mS at 16MHz
// Handles data timeout and switch debounce.
 
// DATA TIMEOUT TIMER
if ( cTimeOut != 0 )
{
cTimeOut--;
}
 
// This timer is preset by the normal operating loop, unless the operating
// loop stops looping, at which point iTimeOut finally decrements to zero
// and resets CPU.
if ( iTimeOut != 0 )
{
iTimeOut--;
}
else
{
reset_cpu(); // force reset
}
 
if ( input ( BUTTON_2 ) == LOW ) // if button still pressed
{
cScreen = WAYPOINT_SCREEN;
cSkip = YES; // skip out of anything in process
cScreenChanged = YES; // repaint complete screen
}
 
if ( input ( BUTTON_3 ) == LOW ) // if button still pressed
{
cScreen = BATTERY_SCREEN;
cSkip = YES; // skip out of anything in process
cScreenChanged = YES; // repaint complete screen
}
 
// SWITCH DEBOUNCE
if ( input ( BUTTON_1 ) == LOW ) // if button still pressed
{
if ( cButtonCount < 255 ) // hold at 255
{
cButtonCount++; // otherwise increment
}
}
else // if button is unpressed
{
if ( cButtonCount > 2 ) // filter out glitches
{
//If button press is greater than 3.3 seconds, cold reset
if ( cButtonCount == 255 )
{
reset_cpu();
}
if ( ( cButtonCount > 57 ) && ( cButtonCount < 255 ) )
{
if ( cScreen != HIDDEN_RMC ) // if not in the middle of getting magnetic variation
{
// cIllumination ^= ON;
output_bit ( LCD_BACKLITE, cIllumination ^= ON );
}
}
// If button press is less than 0.5 second
if ( cButtonCount <= 57 )
{
if ( cScreen != HIDDEN_RMC ) // if not in the middle of getting magnetic variation
{
//if ( cScreen++ >= BATTERY_SCREEN ) // increment to next screen
{
cScreen = POSITION_SCREEN; // wrap
}
cSkip = YES; // skip out of anything in process
cScreenChanged = YES; // repaint complete screen
}
}
}
cButtonCount = 0; // restart
}
}
 
#int_rda
void SerialInterrupt ( void )
{
/*
Reads incoming data from the USART and puts in in a rolling buffer
( but in this application, it should never roll.)
If the buffer is full, this routine just discards the received byte.
Not checking the LRC byte at the end of the NMEA-0183 sentence.
*/
char cChar;
 
if ( rs232_errors & 0x04 ) // get framing error bit from Rx status reg
{
cRxErrorFlag = ON;
}
cChar = getchar(); // get char from UART, clear any errors
 
if ( cRxByteCnt == RX_BUFFER_SIZE ) // is recv fifo full ???
{
goto done;
}
switch ( cRxIsrState )
{
case 0:
{
if ( cChar == DOLLAR ) // if start of NMEA0183 message
{
cRxByteCnt = 0; // reset byte count
cReceiveFlag = OFF; // default to off
cRxMsgTypeReceived = NULL; // set hashed value to null
cRxIsrState++; // next state
}
break;
}
case 1: // five type characters to obtain
case 2:
case 3:
case 4:
case 5:
{
cRxMsgTypeReceived ^= cChar; // hash in msg type
if ( cRxIsrState++ == 5 ) // if time to check message type
{
if ( cRxMsgTypeReceived == cRxMsgTypeDesired ) // if good
{
cReceiveFlag = YES; // enable receiving
cRxBufferWritePtr = cRxBuffer; // reset to beginning of buffer
}
else // don't want this message
{
cRxIsrState = 0; // reset to look for next msg
}
}
break;
}
case 6:
{
/* Case 6 skips the comma character following msg type */
cRxIsrState++;
break;
}
default: // remainder of characters
{
if ( cReceiveFlag == YES ) // if this message is wanted
{
*cRxBufferWritePtr = cChar; // put char in fifo
cRxBufferWritePtr++; // increment pointer
if ( cRxBufferWritePtr == ( cRxBuffer + RX_BUFFER_SIZE ) ) // pointer past end ?
{
cRxBufferWritePtr = cRxBuffer; // set pointer to start of fifo
}
cRxByteCnt++; // Increment byte count
if ( cChar == CR )
{
cRxMsgReady = YES; // signal that message is ready
cReceiveFlag = NO; // no more receive
}
}
}
}
done:;
}
 
/*******************************************************************/
 
void main ( void )
{
char cX;
 
iTimeOut = 65535; // default to very long to get by init
/* INITIALIZE */
output_float ( RX_IN ); // ensure Rx input is HiZ
output_float ( BUTTON_1 ); // ensure switch input is HiZ
output_float ( BUTTON_2 ); // ensure switch input is HiZ
output_float ( BUTTON_3 ); // ensure switch input is HiZ
output_low ( LCD_BACKLITE ); // turn off backlighting
port_b_pullups ( ON ); // enable pullups on switches
 
// GET SAVED SETTINGS
cContrast = read_eeprom ( EEPROM_CONTRAST ); // get stored value
 
// PWM is for display contrast
setup_ccp2 ( CCP_PWM ); // set for PWM mode
//The cycle time will be (1/clock)*4*t2div*(period+1)
// 1/8000000 * 4 * 1 * 128 = 51.2uS = 19.5KHz
setup_timer_2 ( T2_DIV_BY_1, 255, 1 ); // set PWM period
// duty cycle = value*(1/clock)*t2div
// 10 * 1/8000000 * 1 = 1.2uS
set_pwm2_duty ( cContrast ); // set contrast duty cycle
 
// SETUP TIMER 0
// Need 8-bit Timer0 to roll over every 13mS, approximately.
// Roll time = 256 * 1 / ( clock_freq / prescaler setting / 4 )
#if CRYSTAL_FREQ >= 15000000
setup_counters ( RTCC_INTERNAL, RTCC_DIV_256 ); // ~13mS timer wrap
#elif CRYSTAL_FREQ >= 8000000
setup_counters ( RTCC_INTERNAL, RTCC_DIV_128 ); // ~13mS timer wrap
#elif CRYSTAL_FREQ < 8000000
setup_counters ( RTCC_INTERNAL, RTCC_DIV_64 ); // ~13mS timer wrap
#endif
 
// Timer 1 roll time = 65536 * 1 / ( clock_freq / prescaler setting / 4 )
setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_8 ); // 16-bit timer
 
setup_adc_ports ( RA0_RA1_RA3_ANALOG ); /* these three statements set up the ADC */
setup_adc ( ADC_CLOCK_INTERNAL );
cIllumination = OFF;
 
LCD_Init(); // set up LCD for 4-wire bus, etc.
 
/* INIT MESSAGE */
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( LINE_1 + 0 );
printf ( LCD_PutChar, " Northern Light " ); // welcome screen
LCD_SetPosition ( LINE_2 + 2 );
printf ( LCD_PutChar, "Monitor/Repeater" );
LCD_SetPosition ( LINE_3 + 3 );
printf ( LCD_PutChar, "v18 06/21/03" );
LCD_SetPosition ( LINE_4 + 5 );
printf ( LCD_PutChar, "c Jon Fick" );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( LINE_1 + 0);
printf ( LCD_PutChar, " Northern Light " ); // welcome screen
LCD_SetPosition ( LINE_2 + 2 );
printf ( LCD_PutChar, "GPS Repeater" );
LCD_SetPosition ( LINE_3 + 1 );
printf ( LCD_PutChar, "v18 06/21/03" );
LCD_SetPosition ( LINE_4 + 3 );
printf ( LCD_PutChar, "c Jon Fick" );
#endif
delay_ms ( 1000 );
 
/* INSTRUCTION MESSAGE */
LCD_PutCmd ( CLEAR_DISP );
LCD_SetPosition ( LINE_1 + 0 );
printf ( LCD_PutChar, "BUTTONS:" );
LCD_SetPosition ( LINE_2 + 0 );
printf ( LCD_PutChar, "<-- Lat/Lon" );
LCD_SetPosition ( LINE_3 + 0 );
printf ( LCD_PutChar, "<-- Waypoint" );
LCD_SetPosition ( LINE_4 + 0 );
printf ( LCD_PutChar, "<-- Battery" );
delay_ms ( 2000 );
 
/* SETUP MODE */
if ( input ( BUTTON_1 ) == LOW ) // if button is pressed
{
LCD_PutCmd ( CLEAR_DISP );
LCD_SetPosition ( LINE_1 + 0 );
printf ( LCD_PutChar, "Set contrast:" );
LCD_SetPosition ( LINE_2 + 0 );
printf ( LCD_PutChar, "<-- More" );
LCD_SetPosition ( LINE_3 + 0 );
printf ( LCD_PutChar, "<-- DONE" );
LCD_SetPosition ( LINE_4 + 0 );
printf ( LCD_PutChar, "<-- Less" );
while ( input ( BUTTON_1 ) == LOW ); // wait for switch to be released after entering SETUP mode
cContrast = 120; // start at full contrast
cDone = NO;
while ( cDone == NO )
{
set_pwm2_duty ( cContrast ); // update contrast
if ( input ( BUTTON_1 ) == LOW )
{
if ( cContrast > 0 )
{
cContrast--; // more
}
}
if ( input ( BUTTON_2 ) == LOW )
{
cDone = YES; // done
}
if ( input ( BUTTON_3 ) == LOW )
{
if ( cContrast < 255 )
{
cContrast++; // less
}
}
delay_ms ( 30 ); // autorepeat
}
write_eeprom ( EEPROM_CONTRAST, cContrast ); // save CONTRAST to EEPROM
 
LCD_PutCmd ( CLEAR_DISP );
LCD_SetPosition ( LINE_2 + 0 );
printf ( LCD_PutChar, "<- Press initial" );
LCD_SetPosition ( LINE_3 + 0 );
printf ( LCD_PutChar, " bootup screen" );
while ( input ( BUTTON_1 ) == LOW ); // wait until button not pressed
cX = POSITION_SCREEN;
while ( TRUE )
{
LCD_SetPosition ( LINE_4 + 3 );
switch ( cX )
{
case POSITION_SCREEN:
{
printf ( LCD_PutChar, "POSITION " );
break;
}
case WAYPOINT_SCREEN:
{
printf ( LCD_PutChar, "WAYPOINT " );
break;
}
case BATTERY_SCREEN:
{
printf ( LCD_PutChar, "BATTERY " );
break;
}
}
delay_ms ( 750 );
if ( input ( BUTTON_1 ) == LOW ) // if button is pressed
{
write_eeprom ( EEPROM_INITIAL, cX ); // save screen number to EEPROM
break;
}
if ( cX++ == BATTERY_SCREEN )
{
cX = POSITION_SCREEN;
}
}
LCD_PutCmd ( CLEAR_DISP );
}
 
/* This IF/ENDIF is a tool for getting the $GP... codes */
/* that are used in the switch/case in the main loop. */
#if ( GET_GPS_CODE == YES )
printf ( LCD_PutChar, "%u", 'G'^'P'^'R'^'M'^'B');
while ( TRUE );
#endif
 
/* INTERRUPTS */
ext_int_edge ( H_TO_L ); // set falling edge ext interrupt
enable_interrupts ( INT_TIMER1 ); // enable Timer1 interrupt
enable_interrupts ( INT_RDA ); // enable serial interrupt
enable_interrupts ( INT_RTCC ); // enable Timer0 interrupt
enable_interrupts ( INT_AD ); // enable ADC interrupt
enable_interrupts ( GLOBAL ); // enable all interrupts
 
/* VARIABLES */
iVar = NULL; // default, no variation yet
cVarDir = SPACE; // default, no variation yet
cRmcTimer1 = 255; // initialize to 52 seconds
cRmcTimer2 = RMC_TIME; // trigger forced RMC after 10 minutes
cScreen = HIDDEN_RMC; // default screen, get magnetic variation first
cSavedScreen = read_eeprom ( EEPROM_INITIAL ); // restore initial screen
iLastRange = 65535; // make max by default
strcpy ( cToFrom, " " ); // blank by default
cScreenChanged = YES;
cIndicator = 0;
cButtonCount = 0;
cButtonPressed = NO;
cRxErrorFlag = OFF;
 
/* MAIN LOOP */
while ( TRUE )
{
cTimeOut = 188; // 231 * 0.013mS = 3 seconds
switch ( cScreen )
{
case HIDDEN_RMC:
{
InitRxBuffer( GPRMC_CODE ); // set code and turn on serial interrupt
while ( ( cRxMsgReady == NO ) && ( cTimeOut != 0 ) );
disable_interrupts ( INT_RDA ); // ignore rest of messages
if ( cTimeOut != 0 ) // if not timed out
{
GetUtcAndMagVar(); // get and store the magnetic variation
}
cScreen = cSavedScreen; // revert to previous screen
break;
}
case POSITION_SCREEN:
{
if ( cScreenChanged == YES )
{
disable_interrupts ( INT_RDA );
cScreenChanged = NO;
cSkip = NO;
LCD_PutCmd ( CLEAR_DISP );
DisplayTemplateLatLon();
enable_interrupts ( INT_RDA );
}
InitRxBuffer( GPRMC_CODE ); // set code and turn on serial interrupt
while ( ( cRxMsgReady == NO ) && ( cTimeOut != 0 ) && ( cScreenChanged != YES ) );
disable_interrupts ( INT_RDA ); // ignore rest of messages
if ( cScreenChanged == NO )
{
if ( cTimeOut != 0 )
{
DisplayLatLon();
}
else
{
DisplayMessage ( NODATA_MSG );
}
}
cRxErrorFlag = OFF;
break;
}
case WAYPOINT_SCREEN:
{
if ( cScreenChanged == YES )
{
disable_interrupts ( INT_RDA );
cScreenChanged = NO;
cSkip = NO;
LCD_PutCmd ( CLEAR_DISP );
DisplayTemplateWaypoint();
enable_interrupts ( INT_RDA );
}
cSkip = NO;
InitRxBuffer( GPRMB_CODE ); // set code and turn on serial interrupt
while ( ( cRxMsgReady == NO ) && ( cTimeOut != 0 ) && ( cScreenChanged != YES ) );
disable_interrupts ( INT_RDA ); // ignore rest of messages
if ( cScreenChanged == NO )
{
if ( cTimeOut != 0 )
{
DisplayWaypoint();
}
else
{
DisplayMessage ( NODATA_MSG );
}
}
break;
}
case BATTERY_SCREEN:
{
if ( cScreenChanged == YES )
{
disable_interrupts ( INT_RDA );
cScreenChanged = NO;
cSkip = NO;
LCD_PutCmd ( CLEAR_DISP );
DisplayTemplateAnalog();
}
DisplayAnalog();
break;
}
}
 
// Preset timeout counter each loop; RTCC interrupt decrements, resets if zero is reached
iTimeOut = 2000; // ~ 30 seconds
 
/* Flashing activity indicator in lower right of screen. */
cIndicator ^= 1;
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( LINE_4 + 19 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( LINE_4 + 15 );
#endif
if ( cIndicator == 1 )
{
printf ( LCD_PutChar, "%c", ACTIVITY_SYMBOL );
}
else
{
printf ( LCD_PutChar, " " );
}
}
}
 
#separate void DisplayTemplateLatLon ( void )
{
LCD_SetPosition ( LINE_1 );
printf ( LCD_PutChar, "LAT" );
LCD_SetPosition ( LINE_2 );
printf ( LCD_PutChar, "LON" );
LCD_SetPosition ( LINE_3 );
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, "SPEED" );
LCD_SetPosition ( LINE_4 );
printf ( LCD_PutChar, "HEADING" );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, "SPD" );
LCD_SetPosition ( LINE_4 );
printf ( LCD_PutChar, "HDG" );
#endif
}
 
#separate void DisplayTemplateWaypoint ( void )
{
LCD_SetPosition ( LINE_1 );
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, "WAYPOINT" );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, "WAYPT" );
#endif
LCD_SetPosition ( LINE_2 );
printf ( LCD_PutChar, "STEER" );
LCD_SetPosition ( LINE_3 );
printf ( LCD_PutChar, "DIST" );
LCD_SetPosition ( LINE_4 );
printf ( LCD_PutChar, "BEARING" );
}
 
#separate void DisplayTemplateAnalog ( void )
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( LINE_1 + 3 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( LINE_1 + 1 );
#endif
printf ( LCD_PutChar, "BATTERY STATUS" );
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( LINE_2 );
printf ( LCD_PutChar, "Primary" );
LCD_SetPosition ( LINE_3 );
printf ( LCD_PutChar, "Secondary" );
LCD_SetPosition ( LINE_4 );
printf ( LCD_PutChar, "Refrigerator" );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( LINE_2 );
printf ( LCD_PutChar, "Main#1 " );
LCD_SetPosition ( LINE_3 );
printf ( LCD_PutChar, "Main#2 " );
LCD_SetPosition ( LINE_4 );
printf ( LCD_PutChar, "Refrig " );
#endif
}
 
#separate void DisplayLatLon ( void )
{
SkipField ( 1 ); // skip UTC
GetField(); // A = OK, V = warning
if ( ( cC [ 0 ] == 'A' ) && ( !cSkip ) )
{
GetField(); // LAT
if ( !cSkip )
{
DisplayLatitude ( LINE_1 );
}
GetField(); // LON
if ( !cSkip )
{
DisplayLongitude ( LINE_2 );
}
GetField(); // SPEED
if ( !cSkip )
{
DisplaySpeed ( LINE_3 );
}
GetField(); // HEADING
if ( !cSkip )
{
DisplayHeading ( LINE_4 );
}
}
else
{
DisplayMessage( WARNING_MSG );
}
}
 
#separate void DisplayWaypoint ( void )
{
char cX;
 
GetField(); // A = OK, V = warning
if ( ( cC [ 0 ] == 'A' ) && ( !cSkip ) )
{
cX = GetField(); // XTE
if ( !cSkip )
{
DisplaySteer ( LINE_2, cX );
}
SkipField ( 1 ); // skip origin WP ID
GetField(); // DEST WP ID
if ( !cSkip )
{
DisplayWaypointName ( LINE_1, cX );
}
SkipField ( 4 ); // skip LAT, NS, LON, EW
cX = GetField(); // RANGE
if ( !cSkip )
{
DisplayDistance ( LINE_3, cX );
}
cX = GetField(); // BEARING
if ( !cSkip )
{
DisplayBearing ( LINE_4, cX );
}
SkipField ( 1 ); // skip SPEED TO DEST
GetField(); // ARRIVAL FLAG
if ( !cSkip )
{
DisplayArrival ( LINE_1 ); // overwrite RANGE if arrived
}
}
else
{
DisplayMessage( WARNING_MSG );
}
}
 
#separate void DisplayAnalog ( void )
{
long iX;
char cCnt;
 
set_adc_channel ( 0 ); // set channel
delay_us ( 100 ); // wait aquisition time
cAdcDone = NO;
if ( !cSkip )
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( LINE_2 + 13 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( LINE_2 + 8 );
#endif
DisplayScaledVoltage ( read_adc(), MAX_VOLTS );
printf ( LCD_PutChar, " V " );
}
set_adc_channel ( 1 );
delay_us ( 100 );
cAdcDone = NO;
if ( !cSkip )
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( LINE_3 + 13 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( LINE_3 + 8 );
#endif
DisplayScaledVoltage ( read_adc(), MAX_VOLTS );
printf ( LCD_PutChar, " V " );
}
set_adc_channel ( 3 );
delay_us ( 100 );
cAdcDone = NO;
if ( !cSkip )
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( LINE_4 + 13 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( LINE_4 + 8 );
#endif
DisplayScaledVoltage ( read_adc(), MAX_VOLTS );
printf ( LCD_PutChar, " V " );
}
Delay5mS ( 100 ); // slow loop down a bit
}
 
#separate void GetUtcAndMagVar ( void )
{
/*
This is a non-display version of the RMC sentence
to get the A/V warning, the magnetic variation, and the
magnetic direction.
*/
 
GetField(); // get UTC
GetField(); // A = OK, V = warning
if ( cC [ 0 ] == 'A' )
{
SkipField ( 7 ); // skip fields
GetField(); // MAGNETIC VARIATION
iVar = FieldFiveToLong(); // save to global variable, used in other sentences
GetField(); // EW
cVarDir = cC [ 0 ]; // save direction
}
else
{
iVar = NULL; // invalid
cVarDir = SPACE;
}
}
 
/******************************************************************/
 
#separate void DisplayScaledVoltage ( long iV, char cScale )
{
float fX;
 
/*
0 to 5V input at pin 2 results in 0 - 1023. This routine
scales it to something else.
*/
while ( cAdcDone == NO ); // wait for completion by ADC interrupt
if ( iV == 1023 )
{
printf ( LCD_PutChar, "O/L" ); /* print it to the screen */
}
else
{
fX = ( ( float ) iV ) / 1023 * ( float ) cScale; // scale to proper range, 1023 leaves room for out-of-range
printf ( LCD_PutChar, "%2.1f", fX ); /* print it to the screen */
}
}
 
#separate void DisplayArrival ( char cLine )
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 11 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 9 );
#endif
if ( cC [ 0 ] == 'A' )
{
printf ( LCD_PutChar, "Arrived" );
}
else
{
printf ( LCD_PutChar, " " );
}
}
 
#separate void DisplayWaypointName ( char cLine, char cX )
{
/* Displays waypoint name, pads field with blanks */
char cChar, cI;
 
LCD_SetPosition ( cLine );
if ( cX != 0 )
{
printf ( LCD_PutChar, "\"" );
for ( cI = 0; cI < 6; cI++ )
{
cChar = cC [ cI ];
if ( cChar == EOF )
{
break;
}
printf ( LCD_PutChar, "%c", cChar );
}
printf ( LCD_PutChar, "\"" );
// Blank remainder of field
cChar = SPACE;
for ( ; cI < 6; cI++ )
{
printf ( LCD_PutChar, "%c", cChar );
}
}
else
{
printf ( LCD_PutChar, "- none -" );
}
}
 
#separate void DisplaySteer ( char cLine, char cX )
{
/*
Displays A.BC literals, appends 'L' or 'R'.
If less than 1.0, displays feet rather than nm.
Doesn't display distance if on track.
*/
long iX;
char cCnt;
 
if ( cX != 0 )
{
if ( ( cC [ 0 ] != '0' ) || ( cC [ 2 ] != '0' ) || ( cC [ 3 ] != '0' ) ) // if not 0.00
{
LCD_SetPosition ( cLine + 14 );
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, " " ); // blank possible characters
LCD_SetPosition ( cLine + 11 );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, " " ); // blank possible characters
LCD_SetPosition ( cLine + 8);
#endif
if ( cC [ 0 ] == '0' ) // if less than 1.0 nm, display as feet
{
iX = ( 528 * ( long ) ( cC [ 2 ] - 0x30 ) ) + ( 52 * ( long ) ( cC [ 3 ] - 0x30 ) );
printf ( LCD_PutChar, "%luft ", iX );
}
else // if 1.0 nm or greater, display as nautical miles
{
printf ( LCD_PutChar, "%c%c%c%cmi ", cC [ 0 ], cC [ 1 ], cC [ 2 ] , cC [ 3 ] );
}
GetField(); // L or R
LCD_SetPosition ( cLine + 6 );
if ( cC [ 0 ] == 'L' )
{
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, "PORT " );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, "L" );
#endif
}
else
{
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, "STBD " );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, "R" );
#endif
}
}
else // if 0.00
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 11 );
printf ( LCD_PutChar, "On track " );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 6 );
printf ( LCD_PutChar, " On track" );
#endif
GetField(); // dummy L or R
}
}
else
{
LCD_SetPosition ( cLine + 6 );
printf ( LCD_PutChar, " " );
}
}
 
#separate void DisplayDistance ( char cLine, char cX )
{
/* Format: ABC.D nautical miles */
char cChar, cI;
long iThisRange;
 
if ( cX != 0 ) // if waypoint data to display
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 11 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 8 );
#endif
cI = 0;
for ( cI = 0; cI < 2; cI++ ) // find first non-zero
{
cChar = cC [ cI ];
if ( cChar != '0' )
{
break;
}
}
for ( ; cI < 5; cI++ ) // display from there on
{
printf ( LCD_PutChar, "%c", cC [ cI ] );
}
printf ( LCD_PutChar, "nm " ); // pad with blanks
 
/*
The least significant character from the GPS is 0.1 nm.
Multiply whole thing by 10 and make it type long.
Discern if increasing (FROM) or decreasing (TO).
*/
iThisRange = 1000 * ( long ) ( cC [ 0 ] - 0x30 );
iThisRange += 100 * ( long ) ( cC [ 1 ] - 0x30 );
iThisRange += 10 * ( long ) ( cC [ 2 ] - 0x30 );
iThisRange += ( long ) ( cC [ 4 ] - 0x30 );
if ( iThisRange < iLastRange )
{
#if ( DISPLAY_COLS == 20 )
strcpy ( cToFrom, "TO " );
#elif ( DISPLAY_COLS == 16 )
strcpy ( cToFrom, "TO" );
#endif
}
if ( iThisRange > iLastRange )
{
#if ( DISPLAY_COLS == 20 )
strcpy ( cToFrom, "FROM" );
#elif ( DISPLAY_COLS == 16 )
strcpy ( cToFrom, "FM" );
#endif
}
iLastRange = iThisRange; // save this range to compare next time
LCD_SetPosition ( cLine + 5 );
printf ( LCD_PutChar, cToFrom );
}
else
{
LCD_SetPosition ( cLine + 5 );
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, " " );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, " " );
#endif
}
}
 
#separate void DisplayBearing ( char cLine, char cX )
{
/*
Compass variation comes from RMC sentence. If RMC has not run yet
then "T" is displayed after bearing.
*/
long iHdg;
char cTrueIndicator;
 
if ( cX != 0 ) // if waypoint data to display
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 11 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 8 );
#endif
iHdg = FieldFiveToLong();
iHdg = TrueToMag ( iHdg ); // factor variation into heading
if ( ( iVar == NULL ) || ( cVarDir == SPACE ) )
{
cTrueIndicator = 'T';
}
else
{
cTrueIndicator = ' ';
}
printf ( LCD_PutChar, "%lu%c%c ", iHdg, DEGREE, cTrueIndicator ); // pad with blanks
}
else
{
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 11 );
printf ( LCD_PutChar, " " );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 8 );
printf ( LCD_PutChar, " " );
#endif
}
}
 
#separate void DisplayLatitude ( char cLine )
{
/* Displays latitude ABCD.EF as AB CD.EF, appends 'N' or 'S' */
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 8 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 5 );
#endif
if ( cC [ 0 ] == '0' )
{
cC [ 0 ] = SPACE;
}
printf ( LCD_PutChar, "%c%c%c", cC [ 0 ], cC [ 1 ], DEGREE );
printf ( LCD_PutChar, "%c%c%c%c%c%c", cC [ 2 ], cC [ 3 ], cC [ 4 ], cC [ 5 ], cC [ 6 ], cC [ 7 ] );
GetField(); // NS
printf ( LCD_PutChar, " %c", cC [ 0 ] );
}
 
#separate void DisplayLongitude ( char cLine )
{
/* Displays longitude ABCDE.FG as ABC DE.FG, appends 'E' or 'W' */
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 7 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 4 );
#endif
if ( cC [ 0 ] == '0' )
{
cC [ 0 ] = SPACE;
}
if ( cC [ 1 ] == '0' )
{
cC [ 1 ] = SPACE;
}
printf ( LCD_PutChar, "%c%c%c%c", cC [ 0 ], cC [ 1 ], cC [ 2 ], DEGREE );
printf ( LCD_PutChar, "%c%c%c%c%c%c", cC [ 3 ], cC [ 4 ], cC [ 5 ], cC [ 6 ], cC [ 7 ], cC [ 8 ] );
GetField(); // EW
printf ( LCD_PutChar, " %c", cC [ 0 ] );
}
 
#separate void DisplaySpeed ( char cLine )
{
float fX;
 
// Format ABC.D
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 8 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 5 );
#endif
fX = 100 * ( cC [ 0 ] - 0x30 );
fX += 10 * ( cC [ 1 ] - 0x30 );
fX += 1 * ( cC [ 2 ] - 0x30 );
fX += 0.1 * ( cC [ 4 ] - 0x30 );
#if SPEED_UNITS == 2
fX *= 1.852; // convert knots to km/h
#endif
#if SPEED_UNITS == 3
fX *= 1.151; // convert knots to mi/h
#endif
printf ( LCD_PutChar, "%3.1f ", fX ); // print it to the screen
#if SPEED_UNITS == 1
printf ( LCD_PutChar, "kts " ); // print it to the screen
#endif
#if SPEED_UNITS == 2
printf ( LCD_PutChar, "kph " ); // print it to the screen
#endif
#if SPEED_UNITS == 3
printf ( LCD_PutChar, "mph " ); // print it to the screen
#endif
}
 
#separate void DisplayHeading ( char cLine )
{
long iHdg;
 
#if ( DISPLAY_COLS == 20 )
LCD_SetPosition ( cLine + 8 );
#elif ( DISPLAY_COLS == 16 )
LCD_SetPosition ( cLine + 5 );
#endif
iHdg = FieldFiveToLong();
SkipField ( 1 ); // skip fix date
GetField(); // MAGNETIC VARIATION
iVar = FieldFiveToLong(); // save to global variable, used in other sentences
GetField(); // EW
cVarDir = cC [ 0 ]; // save direction
iHdg = TrueToMag ( iHdg ); // factor variation into heading
printf ( LCD_PutChar, "%lu%c ", iHdg, DEGREE ); // pad with blanks
}
 
#separate long FieldFiveToLong ( void )
{
/* Converts ABC.D to long, rounds decimal up or down */
long iX;
 
iX = 100 * ( long ) ( cC [ 0 ] - 0x30 );
iX += 10 * ( long ) ( cC [ 1 ] - 0x30 );
iX += ( long ) ( cC [ 2 ] - 0x30 );
if ( ( cC [ 3 ] == PERIOD ) && ( cC [ 4 ] >= '5' ) )
{
iX++; // round up
}
return ( iX );
}
 
#separate long TrueToMag ( long iH )
{
/* Magnetic variation information comes from the RMC sentence */
 
if ( cVarDir == 'W' )
{
iH += iVar;
}
else
{
if ( iH >= iVar )
{
iH -= iVar; // OK as-is
}
else
{
iH = iH + 360 - iVar; // correct for below zero
}
}
if ( iH >= 360 )
{
iH -= 360;
}
return ( iH );
}
 
#separate void DisplayMessage ( char cMsgNum )
{
LCD_PutCmd ( CLEAR_DISP );
LCD_SetPosition ( LINE_2 );
switch ( cMsgNum )
{
case WARNING_MSG:
{
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, " GPS warning " );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, " GPS warning" );
#endif
break;
}
case NODATA_MSG:
{
if ( cRxErrorFlag == OFF ) // is it a framing error problem ?
{
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, " No data from GPS" );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, "No data from GPS" );
#endif
}
else
{
#if ( DISPLAY_COLS == 20 )
printf ( LCD_PutChar, " Baud error" );
#elif ( DISPLAY_COLS == 16 )
printf ( LCD_PutChar, " Baud error" );
#endif
cRxErrorFlag = OFF;
}
break;
}
}
Delay5mS ( 255 ); // delay 1.25 seconds
iVar = NULL;
cVarDir = SPACE; // signal "no magnetic variation" yet
cScreenChanged = YES;
}
 
#separate void Delay5mS ( char cCnt )
{
char cX;
 
/* This variable-count 5mS delay is interruptable by a button press */
for ( cX = 0; cX < cCnt; cX++ )
{
if ( cScreenChanged == YES )
{
break;
}
delay_ms ( 5 );
}
}
 
#separate char GetField ( void )
{
char cX, cIndex;
 
cX = NULL;
cIndex = 0;
while ( !cSkip )
{
cX = GetRxChar();
if ( ( cX == COMMA ) || ( cX == CR ) )
{
break;
}
cC [ cIndex++ ] = cX;
}
cC [ cIndex ] = EOF;
return ( cIndex ); // return number of characters in field
}
 
#separate void SkipField ( char cCnt )
{
char cX;
 
for ( cX = 0; cX < cCnt; cX++ )
{
while ( GetRxChar() != COMMA );
}
}
 
/* RS232 FUNCTIONS ================================================== */
 
#separate void InitRxBuffer ( char cCode )
{
disable_interrupts ( INT_RDA );
cRxBufferWritePtr = cRxBuffer; // point to beginning of buffer
cRxBufferReadPtr = cRxBuffer;
cRxByteCnt = 0;
cRxIsrState = 0;
cRxMsgReady = NO;
cRxMsgTypeDesired = cCode;
enable_interrupts ( INT_RDA );
}
 
#separate char GetRxChar ( void )
{
// Get the next available byte in the recv fifo.
// Call this function ONLY if the recv fifo contains data.
char cValue;
 
cValue = 0;
if ( cRxByteCnt > 0 ) // For safety, check if there is any data
{
cValue = *cRxBufferReadPtr++; // Read byte from fifo
if ( cRxBufferReadPtr == ( cRxBuffer + RX_BUFFER_SIZE ) ) // Did tail ptr wrap ?
{
cRxBufferReadPtr = cRxBuffer; // If so, reset it to start of buffer
}
cRxByteCnt--; // Decrement byte count
}
return ( cValue );
}
 
/* LCD FUNCTIONS ================================= */
 
#separate void LCD_Init ( void )
{
LCD_SetData ( 0x00 );
delay_ms ( 200 ); /* wait enough time after Vdd rise */
output_low ( LCD_RS );
LCD_SetData ( 0x03 ); /* init with specific nibbles to start 4-bit mode */
LCD_PulseEnable();
LCD_PulseEnable();
LCD_PulseEnable();
LCD_SetData ( 0x02 ); /* set 4-bit interface */
LCD_PulseEnable(); /* send dual nibbles hereafter, MSN first */
LCD_PutCmd ( 0x2C ); /* function set (all lines, 5x7 characters) */
LCD_PutCmd ( 0x0C ); /* display ON, cursor off, no blink */
LCD_PutCmd ( 0x01 ); /* clear display */
LCD_PutCmd ( 0x06 ); /* entry mode set, increment & scroll left */
}
 
#separate void LCD_SetPosition ( unsigned int cX )
{
/* this subroutine works specifically for 4-bit Port A */
LCD_SetData ( swap ( cX ) | 0x08 );
LCD_PulseEnable();
LCD_SetData ( swap ( cX ) );
LCD_PulseEnable();
}
 
#separate void LCD_PutChar ( unsigned int cX )
{
/* this subroutine works specifically for 4-bit Port A */
if ( !cSkip )
{
output_high ( LCD_RS );
LCD_SetData ( swap ( cX ) ); /* send high nibble */
LCD_PulseEnable();
LCD_SetData ( swap ( cX ) ); /* send low nibble */
LCD_PulseEnable();
output_low ( LCD_RS );
}
}
 
#separate void LCD_PutCmd ( unsigned int cX )
{
/* this subroutine works specifically for 4-bit Port A */
LCD_SetData ( swap ( cX ) ); /* send high nibble */
LCD_PulseEnable();
LCD_SetData ( swap ( cX ) ); /* send low nibble */
LCD_PulseEnable();
}
 
#separate void LCD_PulseEnable ( void )
{
output_high ( LCD_EN );
delay_us ( 3 ); // was 10
output_low ( LCD_EN );
delay_ms ( 3 ); // was 5
}
 
#separate void LCD_SetData ( unsigned int cX )
{
output_bit ( LCD_D0, cX & 0x01 );
output_bit ( LCD_D1, cX & 0x02 );
output_bit ( LCD_D2, cX & 0x04 );
output_bit ( LCD_D3, cX & 0x08 );
}
 
/programy/C/PIC/mereni/mereni_ultraz/RUN.PIF
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
/programy/C/PIC/mereni/mereni_ultraz/Run.BAT
0,0 → 1,6
@echo off
picpgr reset PIC16F84
picpgr run
pause
picpgr stop
pause
/programy/C/PIC/mereni/mereni_ultraz/main.BAK
0,0 → 1,23
#include "D:\@Kaklik\programy\PIC_C\mereni_ultraz\main.h"
#use fast_io(A)
 
void main()
{
 
setup_counters(RTCC_INTERNAL,WDT_18MS);
 
set_tris_A(0b11111100);
output_high(pin_A3);
 
mainloop:
output_high(pin_A0);
output_low(pin_A1);
delay_us(9);
output_high(pin_A1);
output_low(pin_A0);
delay_us(9);
 
goto mainloop;
 
}
 
/programy/C/PIC/mereni/mereni_ultraz/main.HEX
0,0 → 1,9
:1000000000308A000428000084011F308305083076
:100010008C008C1D1328073081018130840000087A
:10002000C0390F3880006400813084000008C03976
:100030000C048000FC306500851505148510023025
:100040008C008C0B21280000000085140510023064
:0E0050008C008C0B2928000000001D28630086
:02400E00F93F78
:00000001FF
;PIC16F84
/programy/C/PIC/mereni/mereni_ultraz/main.LST
0,0 → 1,91
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\mereni_ultraz\main.LST
 
ROM used: 47 (5%)
Largest free fragment is 977
RAM used: 2 (3%) at main() level
2 (3%) worst case
Stack: 0 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 004
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\mereni_ultraz\main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
.................... #fuses XT,NOWDT
....................
....................
.................... #use fast_io(A)
....................
.................... void main()
.................... {
0004: CLRF 04
0005: MOVLW 1F
0006: ANDWF 03,F
....................
.................... setup_counters(RTCC_INTERNAL,WDT_18MS);
0007: MOVLW 08
0008: MOVWF 0C
0009: BTFSS 0C.3
000A: GOTO 013
000B: MOVLW 07
000C: CLRF 01
000D: MOVLW 81
000E: MOVWF 04
000F: MOVF 00,W
0010: ANDLW C0
0011: IORLW 0F
0012: MOVWF 00
0013: CLRWDT
0014: MOVLW 81
0015: MOVWF 04
0016: MOVF 00,W
0017: ANDLW C0
0018: IORWF 0C,W
0019: MOVWF 00
....................
.................... set_tris_A(0b11111100);
001A: MOVLW FC
001B: TRIS 5
.................... output_high(pin_A3);
001C: BSF 05.3
....................
.................... mainloop:
.................... output_high(pin_A0);
001D: BSF 05.0
.................... output_low(pin_A1);
001E: BCF 05.1
.................... delay_us(9);
001F: MOVLW 02
0020: MOVWF 0C
0021: DECFSZ 0C,F
0022: GOTO 021
0023: NOP
0024: NOP
.................... output_high(pin_A1);
0025: BSF 05.1
.................... output_low(pin_A0);
0026: BCF 05.0
.................... delay_us(9);
0027: MOVLW 02
0028: MOVWF 0C
0029: DECFSZ 0C,F
002A: GOTO 029
002B: NOP
002C: NOP
....................
.................... goto mainloop;
002D: GOTO 01D
....................
.................... }
....................
002E: SLEEP
....................
/programy/C/PIC/mereni/mereni_ultraz/main.PJT
0,0 → 1,32
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
/programy/C/PIC/mereni/mereni_ultraz/main.SYM
0,0 → 1,13
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
delay_ms.P1
delay_us.P2
 
0004 main
001D mainloop
 
Project Files:
d:\@kaklik\programy\pic_c\mereni_ultraz\main.c
D:\@Kaklik\programy\PIC_C\mereni_ultraz\main.h
C:\PROGRAM FILES\PICC\devices\16F84.h
/programy/C/PIC/mereni/mereni_ultraz/main.c
0,0 → 1,23
#include "D:\@Kaklik\programy\PIC_C\mereni_ultraz\main.h"
#use fast_io(A)
 
void main()
{
 
setup_counters(RTCC_INTERNAL,WDT_18MS);
 
set_tris_A(0b11110100);
output_high(pin_A3);
 
mainloop:
output_high(pin_A0);
output_low(pin_A1);
delay_us(9);
output_high(pin_A1);
output_low(pin_A0);
delay_us(9);
 
goto mainloop;
 
}
 
/programy/C/PIC/mereni/mereni_ultraz/main.cod
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
/programy/C/PIC/mereni/mereni_ultraz/main.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/mereni_ultraz/main.h
0,0 → 1,4
#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,NOWDT
 
/programy/C/PIC/mereni/mereni_ultraz/main.sta
0,0 → 1,27
 
ROM used: 47 (5%)
977 (95%) including unused fragments
 
0 Average locations per line
4 Average locations per statement
 
RAM used: 2 (3%) at main() level
2 (3%) worst case
 
Lines Stmts % Files
----- ----- --- -----
24 11 100 d:\@kaklik\programy\pic_c\mereni_ultraz\main.c
5 0 0 D:\@Kaklik\programy\PIC_C\mereni_ultraz\main.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h
----- -----
280 22 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 43 91 0 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 43 977
 
/programy/C/PIC/mereni/mereni_ultraz/main.tre
0,0 → 1,3
ÀÄmain
ÀÄmain 0/43 Ram=0
ÀÄ??0??
/programy/C/PIC/mereni/mereni_ultraz/prg.bat
0,0 → 1,6
call picpgr stop
call picpgr erase pic16f84
call picpgr program main.hex hex pic16f84
call picpgr run
pause
call picpgr stop
/programy/C/PIC/mereni/mereni_ultraz/vssver.scc
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
/programy/C/PIC/mereni/mys/PIC16F88/mys.BAK
0,0 → 1,52
#include "D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.h"
 
#define LCD_RS PIN_B3 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_A0 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
#include "C:\library\CCS\lcd.c"
 
#include "C:\library\kaklik\CCS\mys_chip_SPI.c" // modul umoznujici komunikaci s cidlem v mysi
 
void main()
{
unsigned int8 hodnota;
signed int16 x=0,y=0;
signed int8 xd,yd;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_64);
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);
 
chip_write(OPERATION_MODE);
chip_write(0x00); // vypne sleep mode
chip_write(CONFIGURATION);
chip_write(0b00000110); // nastavi rozliseni na 600cpi
lcd_init();
Delay_ms(200);
While(true)
{
LCD_gotoxy(1,1);
printf(lcd_putc,"status: %X", hodnota);
delay_ms(20);
 
LCD_gotoxy(1,2);
printf(lcd_putc,"X=%ld Y=%ld", x, y);
delay_ms(20);
 
hodnota=chip_read(MOTION_STATUS);
xd=chip_read(DELTA_X);
yd=chip_read(DELTA_Y);
x+=xd;
y+=yd;
}
}
/programy/C/PIC/mereni/mys/PIC16F88/mys.HEX
0,0 → 1,74
:1000000000308A00862900000A108A100A1182072F
:1000100028340C34013406340A108A100A1182077D
:100020007334743461347434753473343A34203432
:100030002534583400348316061183120615280817
:100040009300831614182628831221288312003463
:1000500031308400000803193C280130F800F70112
:10006000F70B3028F80B2F284A30F700F70B36280B
:1000700000000000800B2D2800340508F039B8007E
:1000800037080F393804850006148316061000005F
:10009000831206108316061083120034B508031D60
:1000A0005328861154288615831686118312B60E9E
:1000B0003608B7003D20B60E3608B7003D200D309B
:1000C000F700F70B612800341430B1002820F0301D
:1000D00083168505831286118316861183120610F6
:1000E000831606108312A8012808023C031C8028EE
:1000F0000230B10028200330B7003D20A80A742840
:100100000D30F700F70B82280230B7003D200D308C
:10011000F700F70B8928A8012808023C031C9C283B
:1001200028080420A900B5012908B6004E20023095
:10013000B1002820A80A8C288A11D4290130310264
:10014000B3003208023C031DA7284030B307330830
:100150008038B400B5013408B6004E2000343008B1
:100160000C3A0319BD28063A0319C528073A0319A2
:10017000CB28053A0319D028D528B5010130B6009F
:100180004E200230B1002820E1280130B1000230B9
:10019000B2009E20E1280130B100B2009E20E1288B
:1001A000B5011030B6004E20E12830081F3C031C7A
:1001B000DB280730B0050130B5003008B6004E200E
:1001C000E1280034AA1BF4280F30F700290EF705A8
:1001D0000A3077020318EF283030F707F1282A0891
:1001E000F7077708B000AF200F30A9050A302902C1
:1001F0000318FC283030FE28AA132A08A90729086A
:10020000B000AF208A11EB290408AF00A91F112903
:100210002D30B000AF208403A809A909A80A03194A
:10022000A90A290EF038AB00AB07E23EAC00323E23
:10023000AE0029080F39AC07AC07AE07E93EAD00A8
:10024000AD07AD07280E0F39AD07AE07AD0DAE0DEA
:10025000AE09AE0D28080F39AE07AB0D0730AA0066
:100260000A30AE07AD03031C3129AD07AC03031CF4
:100270003529AC07AB03031C3929AB07AA03031CC0
:100280003D292A30840007302F0584072E300402D0
:10029000031966290008F700031D54292F1A642941
:1002A000AF195629203057290830AF003030F707F2
:1002B000A9010408A8007708AA007708B000AF20B9
:1002C000280884002A08F700840A46290008F70055
:1002D0003030F7077708B000AF20003483160611DE
:1002E000831206152808930083161418792983129F
:1002F0007429061583121308930183161418822992
:1003000083127D2983121308F800003484011F3002
:10031000830583161F129F121B0880399B0007302C
:100320009C001C0883120D13603083168F0083120B
:10033000A201A301A401A50183161F129F121B088D
:1003400080399B0083121F109412831606118614A5
:100350000612323083129400003083169400010894
:10036000C73908388100831290010030F8009200EC
:1003700000308316920007309C0005080330F70018
:10038000F70BC0291C0883120D1383169D018530BD
:100390008312A8001B20A8011B208630A8001B2068
:1003A0000630A8001B206428C830B1002820013086
:1003B000B100B2009E20A80128080C20A80AF7006E
:1003C000B000AF2008302802031DDC292108A90055
:1003D0003730AA00E2281430B10028200130B100E3
:1003E0000230B2009E205830B000AF203D30B00047
:1003F000AF20103084002308A9002208A80004219F
:100400002030B000AF205930B000AF203D30B000F8
:10041000AF20103084002508A9002408A80004217A
:100420001430B10028200230A8006E217808A10005
:100430000330A8006E217808A6000430A8006E21C1
:100440007808A700FA012608A61BFA03A2070318DA
:10045000A30A7A08A307FA012708A71BFA03A4072F
:0C0460000318A50A7A08A507D729630035
:04400E00793FFF3FB8
:00000001FF
;PIC16F88
/programy/C/PIC/mereni/mys/PIC16F88/mys.LST
0,0 → 1,829
CCS PCM C Compiler, Version 3.221, 27853 26-XII-05 16:54
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.LST
 
ROM used: 566 words (14%)
Largest free fragment is 2048
RAM used: 13 (7%) at main() level
30 (17%) worst case
Stack: 5 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 186
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... #device adc=8
.................... #fuses NOWDT,INTRC, NOPUT, MCLR, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
.................... #use delay(clock=4000000)
*
0028: MOVLW 31
0029: MOVWF 04
002A: MOVF 00,W
002B: BTFSC 03.2
002C: GOTO 03C
002D: MOVLW 01
002E: MOVWF 78
002F: CLRF 77
0030: DECFSZ 77,F
0031: GOTO 030
0032: DECFSZ 78,F
0033: GOTO 02F
0034: MOVLW 4A
0035: MOVWF 77
0036: DECFSZ 77,F
0037: GOTO 036
0038: NOP
0039: NOP
003A: DECFSZ 00,F
003B: GOTO 02D
003C: RETLW 00
....................
....................
....................
.................... #define LCD_RS PIN_B3 // rizeni registru LCD displeje
.................... #define LCD_E PIN_B0 // enable LCD displeje
.................... #define LCD_DATA_LSB PIN_A0 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... #include "C:\library\CCS\lcd.c"
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
.................... // (c)miho 2002,2005
.................... //
.................... // Historie:
.................... //
.................... // 0.00 Uvodni verze se snadnou definici portu LCD displeje
.................... // 0.01 Oprava portu (zapomenute stare identifikatory)
.................... // 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
.................... // 0.03 Doplnena procedura lcd_clr pro smazani displeje
.................... //
.................... //
.................... // Funkce:
.................... //
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
.................... //
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
.................... // \f = \x0C - nova stranka - smazani displeje
.................... // \n = \x0A - odradkovani (prechod na druhou radku)
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
.................... // \r = \x0D - goto home to position 1,1
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
.................... //
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
.................... // nekontroluje parametry
.................... //
.................... // lcd_cursor_on zapne kurzor
.................... // lcd_cursor_off vypne kurzor
.................... //
.................... // lcd_clr smaze displej
.................... //
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
.................... // Na konci se provede lcd_gotoxy(1,1).
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku
.................... //
.................... //
.................... // Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... //
.................... //
.................... // Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
.................... // #define LCD_D1 PIN_C3 // D1
.................... // #define LCD_D2 PIN_C4 // D2
.................... // #define LCD_D3 PIN_C5 // D3
....................
....................
....................
....................
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje
....................
....................
....................
....................
.................... #ifdef LCD_DATA_LSB
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
.................... //
.................... #define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
.................... #define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
.................... #define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
.................... #define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
.................... //
.................... #if LCD_SHIFT>4 // kontrola mezi
.................... #error LCD data port LSB bit not in range 0..4
.................... #endif
.................... #endif
....................
....................
.................... // Definice konstant pro LCD display
.................... //
.................... #define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
.................... #define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
.................... #define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
....................
....................
.................... // Definice rezimu LCD displeje
.................... //
.................... BYTE const LCD_INIT_STRING[4] =
.................... {
.................... 0x28, // intrfejs 4 bity, 2 radky, font 5x7
.................... LCD_CURSOR_OFF_, // display on, kurzor off,
.................... 0x01, // clear displeje
.................... 0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
.................... };
....................
....................
.................... // Odesle nibble do displeje (posle data a klikne signalem e)
.................... //
.................... void lcd_send_nibble( BYTE n )
.................... {
.................... #ifdef LCD_DATA_LSB
.................... // data jsou za sebou na 4 bitech jednoho portu
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
003D: MOVF 05,W
003E: ANDLW F0
003F: MOVWF 38
0040: MOVF 37,W
0041: ANDLW 0F
0042: IORWF 38,W
0043: MOVWF 05
.................... #else
.................... // data jsou na libovolnych 4 bitech libovolnych portu
.................... output_bit(LCD_D0,bit_test(n,0));
.................... output_bit(LCD_D1,bit_test(n,1));
.................... output_bit(LCD_D2,bit_test(n,2));
.................... output_bit(LCD_D3,bit_test(n,3));
.................... #endif
.................... output_bit(LCD_E,1); // vzestupna hrana
0044: BSF 06.0
0045: BSF 03.5
0046: BCF 06.0
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
0047: NOP
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
0048: BCF 03.5
0049: BCF 06.0
004A: BSF 03.5
004B: BCF 06.0
.................... }
004C: BCF 03.5
004D: RETLW 00
....................
....................
.................... // Odesle bajt do registru LCD
.................... //
.................... // Pokud je Adr=0 .. instrukcni registr
.................... // Pokud je Adr=1 .. datovy registr
.................... //
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n )
.................... {
.................... output_bit(LCD_RS,Adr); // vyber registr
004E: MOVF 35,F
004F: BTFSS 03.2
0050: GOTO 053
0051: BCF 06.3
0052: GOTO 054
0053: BSF 06.3
0054: BSF 03.5
0055: BCF 06.3
.................... swap(n);
0056: BCF 03.5
0057: SWAPF 36,F
.................... lcd_send_nibble(n); // posli horni pulku bajtu
0058: MOVF 36,W
0059: MOVWF 37
005A: CALL 03D
.................... swap(n);
005B: SWAPF 36,F
.................... lcd_send_nibble(n); // posli spodni pulku bajtu
005C: MOVF 36,W
005D: MOVWF 37
005E: CALL 03D
.................... delay_us(40); // minimalni doba na provedeni prikazu
005F: MOVLW 0D
0060: MOVWF 77
0061: DECFSZ 77,F
0062: GOTO 061
.................... }
0063: RETLW 00
....................
....................
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
.................... //
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
.................... //
.................... void lcd_init()
.................... {
....................
.................... int i; // pocitadlo cyklu
....................
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
0064: MOVLW 14
0065: MOVWF 31
0066: CALL 028
....................
.................... #ifdef LCD_DATA_LSB
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
0067: MOVLW F0
0068: BSF 03.5
0069: ANDWF 05,F
.................... #endif
....................
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
006A: BCF 03.5
006B: BCF 06.3
006C: BSF 03.5
006D: BCF 06.3
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
006E: BCF 03.5
006F: BCF 06.0
0070: BSF 03.5
0071: BCF 06.0
....................
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
0072: BCF 03.5
0073: CLRF 28
0074: MOVF 28,W
0075: SUBLW 02
0076: BTFSS 03.0
0077: GOTO 080
.................... {
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
0078: MOVLW 02
0079: MOVWF 31
007A: CALL 028
.................... lcd_send_nibble(3); // rezim 8 bitu
007B: MOVLW 03
007C: MOVWF 37
007D: CALL 03D
.................... }
007E: INCF 28,F
007F: GOTO 074
....................
.................... delay_us(40); // cas na zpracovani
0080: MOVLW 0D
0081: MOVWF 77
0082: DECFSZ 77,F
0083: GOTO 082
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
0084: MOVLW 02
0085: MOVWF 37
0086: CALL 03D
.................... delay_us(40); // cas na zpracovani
0087: MOVLW 0D
0088: MOVWF 77
0089: DECFSZ 77,F
008A: GOTO 089
....................
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
008B: CLRF 28
008C: MOVF 28,W
008D: SUBLW 02
008E: BTFSS 03.0
008F: GOTO 09C
.................... {
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
0090: MOVF 28,W
0091: CALL 004
0092: MOVWF 29
0093: CLRF 35
0094: MOVF 29,W
0095: MOVWF 36
0096: CALL 04E
.................... delay_ms(2);
0097: MOVLW 02
0098: MOVWF 31
0099: CALL 028
.................... }
009A: INCF 28,F
009B: GOTO 08C
.................... }
009C: BCF 0A.3
009D: GOTO 1D4 (RETURN)
....................
....................
.................... // Proved presun kurzoru
.................... //
.................... // Pozice 1.1 je domu
.................... //
.................... void lcd_gotoxy( BYTE x, BYTE y)
.................... {
....................
.................... BYTE Adr;
....................
.................... Adr=x-1;
009E: MOVLW 01
009F: SUBWF 31,W
00A0: MOVWF 33
.................... if(y==2)
00A1: MOVF 32,W
00A2: SUBLW 02
00A3: BTFSS 03.2
00A4: GOTO 0A7
.................... Adr+=LCD_LINE_2;
00A5: MOVLW 40
00A6: ADDWF 33,F
....................
.................... lcd_send_byte(0,0x80|Adr);
00A7: MOVF 33,W
00A8: IORLW 80
00A9: MOVWF 34
00AA: CLRF 35
00AB: MOVF 34,W
00AC: MOVWF 36
00AD: CALL 04E
.................... }
00AE: RETLW 00
....................
....................
.................... // Zapis znaku na displej, zpracovani ridicich znaku
.................... //
.................... void lcd_putc( char c)
.................... {
....................
.................... switch (c)
.................... {
00AF: MOVF 30,W
00B0: XORLW 0C
00B1: BTFSC 03.2
00B2: GOTO 0BD
00B3: XORLW 06
00B4: BTFSC 03.2
00B5: GOTO 0C5
00B6: XORLW 07
00B7: BTFSC 03.2
00B8: GOTO 0CB
00B9: XORLW 05
00BA: BTFSC 03.2
00BB: GOTO 0D0
00BC: GOTO 0D5
.................... case '\f' : lcd_send_byte(0,1); // smaz displej
00BD: CLRF 35
00BE: MOVLW 01
00BF: MOVWF 36
00C0: CALL 04E
.................... delay_ms(2);
00C1: MOVLW 02
00C2: MOVWF 31
00C3: CALL 028
.................... break;
00C4: GOTO 0E1
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
00C5: MOVLW 01
00C6: MOVWF 31
00C7: MOVLW 02
00C8: MOVWF 32
00C9: CALL 09E
00CA: GOTO 0E1
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home
00CB: MOVLW 01
00CC: MOVWF 31
00CD: MOVWF 32
00CE: CALL 09E
00CF: GOTO 0E1
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
00D0: CLRF 35
00D1: MOVLW 10
00D2: MOVWF 36
00D3: CALL 04E
00D4: GOTO 0E1
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
00D5: MOVF 30,W
00D6: SUBLW 1F
00D7: BTFSS 03.0
00D8: GOTO 0DB
00D9: MOVLW 07
00DA: ANDWF 30,F
.................... lcd_send_byte(1,c); break; // zapis znak
00DB: MOVLW 01
00DC: MOVWF 35
00DD: MOVF 30,W
00DE: MOVWF 36
00DF: CALL 04E
00E0: GOTO 0E1
.................... }
.................... }
00E1: RETLW 00
....................
....................
.................... // Zapni kurzor
.................... //
.................... void lcd_cursor_on()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_ON_);
.................... }
....................
....................
.................... // Vypni kurzor
.................... //
.................... void lcd_cursor_off()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_OFF_);
.................... }
....................
....................
.................... // Smaz displej
.................... //
.................... void lcd_clr()
.................... {
.................... lcd_putc('\f');
.................... }
....................
....................
.................... // Definice vlastnich fontu
.................... //
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
.................... // priklad pouziti definovanych znaku.
....................
....................
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje
.................... //
.................... void lcd_putc2(int Data)
.................... {
.................... lcd_send_byte(1,Data);
.................... }
....................
....................
.................... // Pomocne definice pro programovani obsahu CGRAM
.................... //
.................... #define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
.................... #define lcd_define_def(String) printf(lcd_putc2,String);
.................... #define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
....................
....................
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
.................... //
.................... #define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
....................
....................
.................... // Pripravene definice fontu vybranych znaku
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
.................... //
.................... #define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
.................... #define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
.................... #define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
.................... #define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
.................... #define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
.................... #define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
.................... #define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
.................... #define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
.................... #define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
.................... #define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
.................... #define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
.................... #define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
.................... #define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
.................... #define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
.................... #define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
.................... #define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
.................... #define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
.................... #define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
.................... #define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
.................... #define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
.................... #define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
.................... #define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
.................... #define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
.................... #define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
.................... #define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
.................... #define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
.................... #define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
.................... #define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
.................... #define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
.................... #define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
.................... #define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
.................... #define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
.................... #define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
.................... #define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
.................... #define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
....................
....................
.................... // Priklad pouziti definovanych znaku
.................... //
.................... //
.................... //void lcd_sample()
.................... //{
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
.................... // // jediny definicni retezec)
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
.................... // delay_ms(1000);
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
.................... // delay_ms(1000);
.................... //}
....................
....................
.................... #include "C:\library\kaklik\CCS\mys_chip_SPI.c" // modul umoznujici komunikaci s cidlem v mysi
.................... ////////////////////////////////////////////////////////////////////////////////
.................... //
.................... // Modul pro prime ovladani senzoru v opticke mysi.
.................... // (Pouziva SPI jednotku)
.................... //
.................... //
.................... ////////////////////////////////////////////////////////////////////////////////
....................
.................... #define SPI_DATA PIN_B2 // je treba nadefinovat datovy pin, aby se vedelo, ktery pin se ma vypinat pri cteni dat.
....................
.................... // Address
.................... #define PRODUCT_ID 0x00
.................... #define PRODUCT_ID4 0x01
.................... #define MOTION_STATUS 0x02 //
.................... #define DELTA_X 0x03 // vycteni os
.................... #define DELTA_Y 0x04 // -//-
.................... #define OPERATION_MODE 0x85 // zapis do ridiciho registru
.................... #define CONFIGURATION 0x86 // zmeni nastaveni rozliseni, atd.
....................
.................... void chip_write(command)
.................... {
.................... output_high(PIN_B2);
*
001B: BSF 03.5
001C: BCF 06.2
001D: BCF 03.5
001E: BSF 06.2
.................... spi_write(command);
001F: MOVF 28,W
0020: MOVWF 13
0021: BSF 03.5
0022: BTFSC 14.0
0023: GOTO 026
0024: BCF 03.5
0025: GOTO 021
.................... }
0026: BCF 03.5
0027: RETLW 00
....................
.................... signed int8 chip_read(command)
.................... {
.................... output_high(SPI_DATA);
*
016E: BSF 03.5
016F: BCF 06.2
0170: BCF 03.5
0171: BSF 06.2
.................... spi_write(command);
0172: MOVF 28,W
0173: MOVWF 13
0174: BSF 03.5
0175: BTFSC 14.0
0176: GOTO 179
0177: BCF 03.5
0178: GOTO 174
.................... output_float(SPI_DATA);
0179: BSF 06.2
.................... return spi_read(0);
017A: BCF 03.5
017B: MOVF 13,W
017C: CLRF 13
017D: BSF 03.5
017E: BTFSC 14.0
017F: GOTO 182
0180: BCF 03.5
0181: GOTO 17D
0182: BCF 03.5
0183: MOVF 13,W
0184: MOVWF 78
.................... }
0185: RETLW 00
....................
....................
.................... void main()
.................... {
0186: CLRF 04
0187: MOVLW 1F
0188: ANDWF 03,F
0189: BSF 03.5
018A: BCF 1F.4
018B: BCF 1F.5
018C: MOVF 1B,W
018D: ANDLW 80
018E: MOVWF 1B
018F: MOVLW 07
0190: MOVWF 1C
0191: MOVF 1C,W
0192: BCF 03.5
0193: BCF 0D.6
0194: MOVLW 60
0195: BSF 03.5
0196: MOVWF 0F
.................... unsigned int8 hodnota;
.................... signed int16 x=0,y=0;
0197: BCF 03.5
0198: CLRF 22
0199: CLRF 23
019A: CLRF 24
019B: CLRF 25
.................... signed int8 xd,yd;
....................
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
019C: BSF 03.5
019D: BCF 1F.4
019E: BCF 1F.5
019F: MOVF 1B,W
01A0: ANDLW 80
01A1: MOVWF 1B
.................... setup_adc(ADC_OFF);
01A2: BCF 03.5
01A3: BCF 1F.0
.................... setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_64);
01A4: BCF 14.5
01A5: BSF 03.5
01A6: BCF 06.2
01A7: BSF 06.1
01A8: BCF 06.4
01A9: MOVLW 32
01AA: BCF 03.5
01AB: MOVWF 14
01AC: MOVLW 00
01AD: BSF 03.5
01AE: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
01AF: MOVF 01,W
01B0: ANDLW C7
01B1: IORLW 08
01B2: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
01B3: BCF 03.5
01B4: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
01B5: MOVLW 00
01B6: MOVWF 78
01B7: MOVWF 12
01B8: MOVLW 00
01B9: BSF 03.5
01BA: MOVWF 12
.................... setup_comparator(NC_NC_NC_NC);
01BB: MOVLW 07
01BC: MOVWF 1C
01BD: MOVF 05,W
01BE: MOVLW 03
01BF: MOVWF 77
01C0: DECFSZ 77,F
01C1: GOTO 1C0
01C2: MOVF 1C,W
01C3: BCF 03.5
01C4: BCF 0D.6
.................... setup_vref(FALSE);
01C5: BSF 03.5
01C6: CLRF 1D
....................
.................... chip_write(OPERATION_MODE);
01C7: MOVLW 85
01C8: BCF 03.5
01C9: MOVWF 28
01CA: CALL 01B
.................... chip_write(0x00); // vypne sleep mode
01CB: CLRF 28
01CC: CALL 01B
....................
.................... chip_write(CONFIGURATION);
01CD: MOVLW 86
01CE: MOVWF 28
01CF: CALL 01B
.................... chip_write(0b00000110); // nastavi rozliseni na 600cpi
01D0: MOVLW 06
01D1: MOVWF 28
01D2: CALL 01B
....................
.................... lcd_init();
01D3: GOTO 064
.................... Delay_ms(200);
01D4: MOVLW C8
01D5: MOVWF 31
01D6: CALL 028
....................
.................... While(true)
.................... {
.................... LCD_gotoxy(1,1);
01D7: MOVLW 01
01D8: MOVWF 31
01D9: MOVWF 32
01DA: CALL 09E
.................... printf(lcd_putc,"status: %X", hodnota);
01DB: CLRF 28
01DC: MOVF 28,W
01DD: CALL 00C
01DE: INCF 28,F
01DF: MOVWF 77
01E0: MOVWF 30
01E1: CALL 0AF
01E2: MOVLW 08
01E3: SUBWF 28,W
01E4: BTFSS 03.2
01E5: GOTO 1DC
01E6: MOVF 21,W
01E7: MOVWF 29
01E8: MOVLW 37
01E9: MOVWF 2A
01EA: GOTO 0E2
.................... delay_ms(20);
01EB: MOVLW 14
01EC: MOVWF 31
01ED: CALL 028
....................
.................... LCD_gotoxy(1,2);
01EE: MOVLW 01
01EF: MOVWF 31
01F0: MOVLW 02
01F1: MOVWF 32
01F2: CALL 09E
.................... printf(lcd_putc,"X=%ld Y=%ld", x, y);
01F3: MOVLW 58
01F4: MOVWF 30
01F5: CALL 0AF
01F6: MOVLW 3D
01F7: MOVWF 30
01F8: CALL 0AF
01F9: MOVLW 10
01FA: MOVWF 04
01FB: MOVF 23,W
01FC: MOVWF 29
01FD: MOVF 22,W
01FE: MOVWF 28
01FF: CALL 104
0200: MOVLW 20
0201: MOVWF 30
0202: CALL 0AF
0203: MOVLW 59
0204: MOVWF 30
0205: CALL 0AF
0206: MOVLW 3D
0207: MOVWF 30
0208: CALL 0AF
0209: MOVLW 10
020A: MOVWF 04
020B: MOVF 25,W
020C: MOVWF 29
020D: MOVF 24,W
020E: MOVWF 28
020F: CALL 104
.................... delay_ms(20);
0210: MOVLW 14
0211: MOVWF 31
0212: CALL 028
....................
.................... hodnota=chip_read(MOTION_STATUS);
0213: MOVLW 02
0214: MOVWF 28
0215: CALL 16E
0216: MOVF 78,W
0217: MOVWF 21
....................
.................... xd=chip_read(DELTA_X);
0218: MOVLW 03
0219: MOVWF 28
021A: CALL 16E
021B: MOVF 78,W
021C: MOVWF 26
.................... yd=chip_read(DELTA_Y);
021D: MOVLW 04
021E: MOVWF 28
021F: CALL 16E
0220: MOVF 78,W
0221: MOVWF 27
....................
.................... x+=xd;
0222: CLRF 7A
0223: MOVF 26,W
0224: BTFSC 26.7
0225: DECF 7A,F
0226: ADDWF 22,F
0227: BTFSC 03.0
0228: INCF 23,F
0229: MOVF 7A,W
022A: ADDWF 23,F
.................... y+=yd;
022B: CLRF 7A
022C: MOVF 27,W
022D: BTFSC 27.7
022E: DECF 7A,F
022F: ADDWF 24,F
0230: BTFSC 03.0
0231: INCF 25,F
0232: MOVF 7A,W
0233: ADDWF 25,F
.................... }
0234: GOTO 1D7
.................... }
....................
0235: SLEEP
 
Configuration Fuses:
Word 1: 3F79 NOWDT NOPUT MCLR BROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC
Word 2: 3FFF FCMEN IESO
/programy/C/PIC/mereni/mys/PIC16F88/mys.PJT
0,0 → 1,39
[PROJECT]
Target=mys.HEX
Development_Mode=
Processor=0x688F
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=mys.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[mys.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=mys.c
 
[Windows]
0=0000 mys.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.c
2=C:\library\kaklik\CCS\mys_chip_SPI.c
3=D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.h
4=C:\Program Files\PICC\devices\16F88.h
5=C:\library\CCS\lcd.c
6=
/programy/C/PIC/mereni/mys/PIC16F88/mys.SYM
0,0 → 1,79
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
021 main.hodnota
022-023 main.x
024-025 main.y
026 main.xd
027 main.yd
028 chip_write.command
028 lcd_init.i
028 chip_read.command
028-029 @PRINTF_LD_278.P1
028 main.@SCRATCH
029 @PRINTF_X_278.P1
029 lcd_init.@SCRATCH
02A @PRINTF_X_278.P1
02A @PRINTF_LD_278.@SCRATCH
02B @PRINTF_LD_278.@SCRATCH
02C @PRINTF_LD_278.@SCRATCH
02D @PRINTF_LD_278.@SCRATCH
02E @PRINTF_LD_278.@SCRATCH
02F @PRINTF_LD_278.@SCRATCH
030 lcd_putc.c
031 @delay_ms1.P1
031 lcd_gotoxy.x
032 lcd_gotoxy.y
033 lcd_gotoxy.Adr
034 lcd_gotoxy.@SCRATCH
035 lcd_send_byte.Adr
036 lcd_send_byte.n
037 lcd_send_nibble.n
038 lcd_send_nibble.@SCRATCH
039 lcd_send_nibble.@SCRATCH
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
09C.6 C1OUT
09C.7 C2OUT
 
0028 @delay_ms1
0004 @const27
003D lcd_send_nibble
004E lcd_send_byte
0064 lcd_init
009E lcd_gotoxy
00AF lcd_putc
001B chip_write
016E chip_read
0186 main
000C @const10113
00E2 @PRINTF_X_278
0104 @PRINTF_LD_278
0186 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.c
D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.h
C:\Program Files\PICC\devices\16F88.h
C:\library\CCS\lcd.c
C:\library\kaklik\CCS\mys_chip_SPI.c
 
Compiler Settings:
Processor: PIC16F88
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.HEX
Symbols: D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.SYM
List: D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.LST
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.sta
/programy/C/PIC/mereni/mys/PIC16F88/mys.c
0,0 → 1,52
#include "D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.h"
 
#define LCD_RS PIN_B3 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_A0 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
#include "C:\library\CCS\lcd.c"
 
#include "C:\library\kaklik\CCS\mys_chip_SPI.c" // modul umoznujici komunikaci s cidlem v mysi
 
void main()
{
unsigned int8 hodnota;
signed int16 x=0,y=0;
signed int8 xd,yd;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_64);
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);
 
chip_write(OPERATION_MODE);
chip_write(0x00); // vypne sleep mode
chip_write(CONFIGURATION);
chip_write(0b00000110); // nastavi rozliseni na 600cpi
lcd_init();
Delay_ms(200);
While(true)
{
LCD_gotoxy(1,1);
printf(lcd_putc,"status: %X", hodnota);
delay_ms(20);
 
LCD_gotoxy(1,2);
printf(lcd_putc,"X=%ld Y=%ld", x, y);
delay_ms(20);
 
hodnota=chip_read(MOTION_STATUS);
xd=chip_read(DELTA_X); //precte z cidla zmenu polohy
yd=chip_read(DELTA_Y);
x+=xd;
y+=yd;
}
}
/programy/C/PIC/mereni/mys/PIC16F88/mys.cof
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
/programy/C/PIC/mereni/mys/PIC16F88/mys.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/mys/PIC16F88/mys.h
0,0 → 1,5
#include <16F88.h>
#device adc=8
#fuses NOWDT,INTRC, NOPUT, MCLR, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, FCMEN, IESO
#use delay(clock=4000000)
 
/programy/C/PIC/mereni/mys/PIC16F88/mys.sta
0,0 → 1,42
 
ROM used: 566 (14%)
566 (14%) including unused fragments
 
1 Average locations per line
7 Average locations per statement
 
RAM used: 13 (7%) at main() level
30 (17%) worst case
 
Lines Stmts % Files
----- ----- --- -----
53 27 34 D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.c
6 0 0 D:\KAKLIK\programy\PIC_C\mereni\mys\PIC16F88\mys.h
275 0 0 C:\Program Files\PICC\devices\16F88.h
312 47 44 C:\library\CCS\lcd.c
33 6 4 C:\library\kaklik\CCS\mys_chip_SPI.c
----- -----
1358 160 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 4 1 @delay_ms1
0 8 1 0 @const27
0 17 3 3 lcd_send_nibble
0 22 4 2 lcd_send_byte
0 58 10 2 lcd_init
0 17 3 4 lcd_gotoxy
0 51 9 1 lcd_putc
0 13 2 1 chip_write
0 24 4 1 chip_read
0 176 31 8 main
0 15 3 0 @const10113
0 34 6 2 @PRINTF_X_278
0 106 19 8 @PRINTF_LD_278
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 562 1482
00800-00FFF 0 2048
 
/programy/C/PIC/mereni/mys/PIC16F88/mys.tre
0,0 → 1,301
ÀÄmys
ÀÄmain 0/176 Ram=8
ÃÄ??0??
ÃÄchip_write 0/13 Ram=1
ÃÄchip_write 0/13 Ram=1
ÃÄchip_write 0/13 Ram=1
ÃÄchip_write 0/13 Ram=1
ÃÄlcd_init 0/58 Ram=2
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@const27 0/8 Ram=0
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@const10113 0/15 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_X_278 0/34 Ram=2
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_LD_278 0/106 Ram=8
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@PRINTF_LD_278 0/106 Ram=8
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ³ ÀÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/17 Ram=3
³ ÀÄlcd_send_nibble 0/17 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄchip_read 0/24 Ram=1
ÃÄchip_read 0/24 Ram=1
ÀÄchip_read 0/24 Ram=1
/programy/C/PIC/mereni/mys/mys.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
/programy/C/PIC/mereni/otmer/16F873/LCD.C
0,0 → 1,311
// LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
// (c)miho 2002,2005
//
// Historie:
//
// 0.00 Uvodni verze se snadnou definici portu LCD displeje
// 0.01 Oprava portu (zapomenute stare identifikatory)
// 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
// 0.03 Doplnena procedura lcd_clr pro smazani displeje
//
//
// Funkce:
//
// lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
//
// lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
// \f = \x0C - nova stranka - smazani displeje
// \n = \x0A - odradkovani (prechod na druhou radku)
// \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
// \r = \x0D - goto home to position 1,1
// \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
// \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
// Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
//
// lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
// nekontroluje parametry
//
// lcd_cursor_on zapne kurzor
// lcd_cursor_off vypne kurzor
//
// lcd_clr smaze displej
//
// lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
// retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
// Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
// Na konci se provede lcd_gotoxy(1,1).
// Na konci teto knihovny je priklad pouziti definovanych znaku
//
//
// Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
//
// #define LCD_RS PIN_B2 // rizeni registru LCD displeje
// #define LCD_E PIN_B1 // enable LCD displeje
// #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
//
//
// Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
//
// #define LCD_RS PIN_B2 // rizeni registru LCD displeje
// #define LCD_E PIN_B1 // enable LCD displeje
// #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
// #define LCD_D1 PIN_C3 // D1
// #define LCD_D2 PIN_C4 // D2
// #define LCD_D3 PIN_C5 // D3
 
 
 
 
// Privatni sekce, cist jen v pripade, ze neco nefunguje
 
 
 
 
#ifdef LCD_DATA_LSB
// Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
// bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
// v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
//
#define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
#define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
#define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
#define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
//
#if LCD_SHIFT>4 // kontrola mezi
#error LCD data port LSB bit not in range 0..4
#endif
#endif
 
 
// Definice konstant pro LCD display
//
#define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
#define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
#define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
 
 
// Definice rezimu LCD displeje
//
BYTE const LCD_INIT_STRING[4] =
{
0x28, // intrfejs 4 bity, 2 radky, font 5x7
LCD_CURSOR_OFF_, // display on, kurzor off,
0x01, // clear displeje
0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
};
 
 
// Odesle nibble do displeje (posle data a klikne signalem e)
//
void lcd_send_nibble( BYTE n )
{
#ifdef LCD_DATA_LSB
// data jsou za sebou na 4 bitech jednoho portu
*LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
#else
// data jsou na libovolnych 4 bitech libovolnych portu
output_bit(LCD_D0,bit_test(n,0));
output_bit(LCD_D1,bit_test(n,1));
output_bit(LCD_D2,bit_test(n,2));
output_bit(LCD_D3,bit_test(n,3));
#endif
output_bit(LCD_E,1); // vzestupna hrana
delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
}
 
 
// Odesle bajt do registru LCD
//
// Pokud je Adr=0 .. instrukcni registr
// Pokud je Adr=1 .. datovy registr
//
void lcd_send_byte( BOOLEAN Adr, BYTE n )
{
output_bit(LCD_RS,Adr); // vyber registr
swap(n);
lcd_send_nibble(n); // posli horni pulku bajtu
swap(n);
lcd_send_nibble(n); // posli spodni pulku bajtu
delay_us(40); // minimalni doba na provedeni prikazu
}
 
 
// Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
//
// Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
//
void lcd_init()
{
 
int i; // pocitadlo cyklu
 
delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
 
#ifdef LCD_DATA_LSB
// data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
*LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
#endif
 
output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
 
for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
{
delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
lcd_send_nibble(3); // rezim 8 bitu
}
 
delay_us(40); // cas na zpracovani
lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
delay_us(40); // cas na zpracovani
 
for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
delay_ms(2);
}
}
 
 
// Proved presun kurzoru
//
// Pozice 1.1 je domu
//
void lcd_gotoxy( BYTE x, BYTE y)
{
 
BYTE Adr;
 
Adr=x-1;
if(y==2)
Adr+=LCD_LINE_2;
 
lcd_send_byte(0,0x80|Adr);
}
 
 
// Zapis znaku na displej, zpracovani ridicich znaku
//
void lcd_putc( char c)
{
 
switch (c)
{
case '\f' : lcd_send_byte(0,1); // smaz displej
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
case '\r' : lcd_gotoxy(1,1); break; // presun home
case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
lcd_send_byte(1,c); break; // zapis znak
}
}
 
 
// Zapni kurzor
//
void lcd_cursor_on()
{
lcd_send_byte(0,LCD_CURSOR_ON_);
}
 
 
// Vypni kurzor
//
void lcd_cursor_off()
{
lcd_send_byte(0,LCD_CURSOR_OFF_);
}
 
 
// Smaz displej
//
void lcd_clr()
{
lcd_putc('\f');
}
 
 
// Definice vlastnich fontu
//
// Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
// Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
// priklad pouziti definovanych znaku.
 
 
// Pomocna procedura pro posilani ridicich dat do radice displeje
//
void lcd_putc2(int Data)
{
lcd_send_byte(1,Data);
}
 
 
// Pomocne definice pro programovani obsahu CGRAM
//
#define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
#define lcd_define_def(String) printf(lcd_putc2,String);
#define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
 
 
// Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
//
#define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
 
 
// Pripravene definice fontu vybranych znaku
// V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
//
#define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
#define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
#define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
#define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
#define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
#define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
#define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
#define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
#define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
#define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
#define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
#define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
#define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
#define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
#define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
#define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
#define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
#define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
#define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
#define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
#define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
#define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
#define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
#define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
#define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
#define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
#define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
#define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
#define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
#define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
#define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
#define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
#define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
#define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
#define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
 
 
// Priklad pouziti definovanych znaku
//
//
//void lcd_sample()
//{
// lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
// lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
// // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
// // jediny definicni retezec)
// printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
// delay_ms(1000);
// lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
// delay_ms(1000);
//}
/programy/C/PIC/mereni/otmer/16F873/otmer.BAK
0,0 → 1,44
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h"
 
//Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
 
#include "LCD.C"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "C:\library\kaklik\ccs\shift_reg.c"
 
void main()
{
unsigned int16 otacky;
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_2);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_OFF);
 
lcd_init();
 
while (true)
{
set_timer1(0);
 
Delay_ms(500);
otacky=get_timer1();
otacky=otacky*40;
 
LCD_gotoxy(2,2);
printf(lcd_putc,"otacky:%lu ot/min ",otacky);
}
 
}
/programy/C/PIC/mereni/otmer/16F873/otmer.HEX
0,0 → 1,64
:1000000000308A00582900000A108A100A1182075D
:1000100028340C34013406340A108A100A1182077D
:100020006F347434613463346B3479343A34253446
:100030006C34753420346F3474342F346D34693437
:100040006E34203420340034323084000008031928
:1000500038280130A100A001A00B2C28A10B2B28CF
:100060004A30A000A00B322800000000800B292895
:10007000003407080F39B900380EA000F030A00591
:100080002008F03939048700061483160610000092
:10009000831206108316061083120034B608031D5F
:1000A0005328861054288614831686108312B70EA0
:1000B0003708B8003920B70E3708B80039200D309E
:1000C000A000A00B612800341430B20024200F30AF
:1000D00083168705831286108316861083120610F6
:1000E000831606108312A8012808023C031C8028EE
:1000F0000230B20024200330B8003920A80A742846
:100100000D30A000A00B82280230B80039200D303D
:10011000A000A00B8928A8012808023C031C9C28E9
:1001200028080420A900B6012908B7004E20023093
:10013000B2002420A80A8C288A119C291030A00023
:10014000A301AC01A90CA80C031CAC282A08A30726
:100150000318AC0A2B08AC07AC0CA30CA20CA10C26
:10016000A00BA2288A11B92901303202B400330849
:10017000023C031DBD284030B40734088038B50068
:10018000B6013508B7004E20003431080C3A031987
:10019000D328063A0319DB28073A0319E128053A60
:1001A0000319E628EB28B6010130B7004E200230D3
:1001B000B2002420F7280130B2000230B300B4208E
:1001C000F7280130B200B300B420F728B601103090
:1001D000B7004E20F72831081F3C031CF1280730D8
:1001E000B1050130B6003108B7004E20F7280034C1
:1001F0000408B0002A0EF038AC00AC07E23EAD00B7
:10020000323EAF002A080F39AD07AD07AF07E93E10
:10021000AE00AE07AE07290E0F39AE07AF07AE0D21
:10022000AF0DAF09AF0D29080F39AF07AC0D07307F
:10023000AB000A30AF07AE03031C1A29AE07AD03AB
:10024000031C1E29AD07AC03031C2229AC07AB031A
:10025000031C26292B3084000730300584072F30FB
:10026000040203194F290008A000031D3D29301A7C
:100270004D29B0193F29203040290830B0003030D6
:10028000A007AA010408A9002008AB002008B100BB
:10029000C520290884002B08A000840A2F29000803
:1002A000A0003030A0072008B100C5208A11D8294D
:1002B00084011F30830583161F149F141F159F117F
:1002C000FF308312A50083161F149F141F159F1162
:1002D00083121F109412A51225088316870083121B
:1002E00025162508831687008312A5112508831675
:1002F0008700003083129400831694000108C739E8
:10030000383881009730831290000030A1009200AD
:10031000003083169200831225112508831687006A
:10032000831207110C309700A51425088316870047
:1003300083129D019D0164288F018E010230A80067
:10034000FA30B2002420A80BA0290F08A3000E0841
:10035000A0000F082302031DA5292008A6002308DA
:10036000A7002708A9002608A800AB012830AA008A
:100370009E282208A7002108A6002608A00027081A
:10038000A300C2290230B200B300B420A80128089B
:100390000C20A80AA000B100C52007302802031DC8
:1003A000C729103084002708AA002608A900F828C9
:1003B0000A30A90029080C20A90AA000B100C52014
:0C03C00013302902031DDA299C29630078
:02400E00793FF8
:00000001FF
;PIC16F873
/programy/C/PIC/mereni/otmer/16F873/otmer.LST
0,0 → 1,762
CCS PCM C Compiler, Version 3.221, 27853 19-VIII-05 18:09
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.LST
 
ROM used: 486 words (12%)
Largest free fragment is 2048
RAM used: 10 (5%) at main() level
27 (14%) worst case
Stack: 5 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 158
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h"
.................... #include <16F873.h>
.................... //////// Standard Header file for the PIC16F873 device ////////////////
.................... #device PIC16F873
.................... #list
....................
.................... #device adc=8
.................... #fuses NOWDT,XT, NOPUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
.................... #use delay(clock=4000000)
*
0024: MOVLW 32
0025: MOVWF 04
0026: MOVF 00,W
0027: BTFSC 03.2
0028: GOTO 038
0029: MOVLW 01
002A: MOVWF 21
002B: CLRF 20
002C: DECFSZ 20,F
002D: GOTO 02C
002E: DECFSZ 21,F
002F: GOTO 02B
0030: MOVLW 4A
0031: MOVWF 20
0032: DECFSZ 20,F
0033: GOTO 032
0034: NOP
0035: NOP
0036: DECFSZ 00,F
0037: GOTO 029
0038: RETLW 00
....................
....................
....................
.................... //Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
....................
.................... #define LCD_RS PIN_B1 // rizeni registru LCD displeje
.................... #define LCD_E PIN_B0 // enable LCD displeje
.................... #define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
....................
.................... #include "LCD.C"
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
.................... // (c)miho 2002,2005
.................... //
.................... // Historie:
.................... //
.................... // 0.00 Uvodni verze se snadnou definici portu LCD displeje
.................... // 0.01 Oprava portu (zapomenute stare identifikatory)
.................... // 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
.................... // 0.03 Doplnena procedura lcd_clr pro smazani displeje
.................... //
.................... //
.................... // Funkce:
.................... //
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
.................... //
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
.................... // \f = \x0C - nova stranka - smazani displeje
.................... // \n = \x0A - odradkovani (prechod na druhou radku)
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
.................... // \r = \x0D - goto home to position 1,1
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
.................... //
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
.................... // nekontroluje parametry
.................... //
.................... // lcd_cursor_on zapne kurzor
.................... // lcd_cursor_off vypne kurzor
.................... //
.................... // lcd_clr smaze displej
.................... //
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
.................... // Na konci se provede lcd_gotoxy(1,1).
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku
.................... //
.................... //
.................... // Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... //
.................... //
.................... // Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
.................... // #define LCD_D1 PIN_C3 // D1
.................... // #define LCD_D2 PIN_C4 // D2
.................... // #define LCD_D3 PIN_C5 // D3
....................
....................
....................
....................
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje
....................
....................
....................
....................
.................... #ifdef LCD_DATA_LSB
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
.................... //
.................... #define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
.................... #define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
.................... #define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
.................... #define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
.................... //
.................... #if LCD_SHIFT>4 // kontrola mezi
.................... #error LCD data port LSB bit not in range 0..4
.................... #endif
.................... #endif
....................
....................
.................... // Definice konstant pro LCD display
.................... //
.................... #define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
.................... #define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
.................... #define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
....................
....................
.................... // Definice rezimu LCD displeje
.................... //
.................... BYTE const LCD_INIT_STRING[4] =
.................... {
.................... 0x28, // intrfejs 4 bity, 2 radky, font 5x7
.................... LCD_CURSOR_OFF_, // display on, kurzor off,
.................... 0x01, // clear displeje
.................... 0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
.................... };
....................
....................
.................... // Odesle nibble do displeje (posle data a klikne signalem e)
.................... //
.................... void lcd_send_nibble( BYTE n )
.................... {
.................... #ifdef LCD_DATA_LSB
.................... // data jsou za sebou na 4 bitech jednoho portu
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
0039: MOVF 07,W
003A: ANDLW 0F
003B: MOVWF 39
003C: SWAPF 38,W
003D: MOVWF 20
003E: MOVLW F0
003F: ANDWF 20,F
0040: MOVF 20,W
0041: ANDLW F0
0042: IORWF 39,W
0043: MOVWF 07
.................... #else
.................... // data jsou na libovolnych 4 bitech libovolnych portu
.................... output_bit(LCD_D0,bit_test(n,0));
.................... output_bit(LCD_D1,bit_test(n,1));
.................... output_bit(LCD_D2,bit_test(n,2));
.................... output_bit(LCD_D3,bit_test(n,3));
.................... #endif
.................... output_bit(LCD_E,1); // vzestupna hrana
0044: BSF 06.0
0045: BSF 03.5
0046: BCF 06.0
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
0047: NOP
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
0048: BCF 03.5
0049: BCF 06.0
004A: BSF 03.5
004B: BCF 06.0
.................... }
004C: BCF 03.5
004D: RETLW 00
....................
....................
.................... // Odesle bajt do registru LCD
.................... //
.................... // Pokud je Adr=0 .. instrukcni registr
.................... // Pokud je Adr=1 .. datovy registr
.................... //
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n )
.................... {
.................... output_bit(LCD_RS,Adr); // vyber registr
004E: MOVF 36,F
004F: BTFSS 03.2
0050: GOTO 053
0051: BCF 06.1
0052: GOTO 054
0053: BSF 06.1
0054: BSF 03.5
0055: BCF 06.1
.................... swap(n);
0056: BCF 03.5
0057: SWAPF 37,F
.................... lcd_send_nibble(n); // posli horni pulku bajtu
0058: MOVF 37,W
0059: MOVWF 38
005A: CALL 039
.................... swap(n);
005B: SWAPF 37,F
.................... lcd_send_nibble(n); // posli spodni pulku bajtu
005C: MOVF 37,W
005D: MOVWF 38
005E: CALL 039
.................... delay_us(40); // minimalni doba na provedeni prikazu
005F: MOVLW 0D
0060: MOVWF 20
0061: DECFSZ 20,F
0062: GOTO 061
.................... }
0063: RETLW 00
....................
....................
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
.................... //
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
.................... //
.................... void lcd_init()
.................... {
....................
.................... int i; // pocitadlo cyklu
....................
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
0064: MOVLW 14
0065: MOVWF 32
0066: CALL 024
....................
.................... #ifdef LCD_DATA_LSB
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
0067: MOVLW 0F
0068: BSF 03.5
0069: ANDWF 07,F
.................... #endif
....................
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
006A: BCF 03.5
006B: BCF 06.1
006C: BSF 03.5
006D: BCF 06.1
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
006E: BCF 03.5
006F: BCF 06.0
0070: BSF 03.5
0071: BCF 06.0
....................
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
0072: BCF 03.5
0073: CLRF 28
0074: MOVF 28,W
0075: SUBLW 02
0076: BTFSS 03.0
0077: GOTO 080
.................... {
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
0078: MOVLW 02
0079: MOVWF 32
007A: CALL 024
.................... lcd_send_nibble(3); // rezim 8 bitu
007B: MOVLW 03
007C: MOVWF 38
007D: CALL 039
.................... }
007E: INCF 28,F
007F: GOTO 074
....................
.................... delay_us(40); // cas na zpracovani
0080: MOVLW 0D
0081: MOVWF 20
0082: DECFSZ 20,F
0083: GOTO 082
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
0084: MOVLW 02
0085: MOVWF 38
0086: CALL 039
.................... delay_us(40); // cas na zpracovani
0087: MOVLW 0D
0088: MOVWF 20
0089: DECFSZ 20,F
008A: GOTO 089
....................
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
008B: CLRF 28
008C: MOVF 28,W
008D: SUBLW 02
008E: BTFSS 03.0
008F: GOTO 09C
.................... {
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
0090: MOVF 28,W
0091: CALL 004
0092: MOVWF 29
0093: CLRF 36
0094: MOVF 29,W
0095: MOVWF 37
0096: CALL 04E
.................... delay_ms(2);
0097: MOVLW 02
0098: MOVWF 32
0099: CALL 024
.................... }
009A: INCF 28,F
009B: GOTO 08C
.................... }
009C: BCF 0A.3
009D: GOTO 19C (RETURN)
....................
....................
.................... // Proved presun kurzoru
.................... //
.................... // Pozice 1.1 je domu
.................... //
.................... void lcd_gotoxy( BYTE x, BYTE y)
.................... {
....................
.................... BYTE Adr;
....................
.................... Adr=x-1;
*
00B4: MOVLW 01
00B5: SUBWF 32,W
00B6: MOVWF 34
.................... if(y==2)
00B7: MOVF 33,W
00B8: SUBLW 02
00B9: BTFSS 03.2
00BA: GOTO 0BD
.................... Adr+=LCD_LINE_2;
00BB: MOVLW 40
00BC: ADDWF 34,F
....................
.................... lcd_send_byte(0,0x80|Adr);
00BD: MOVF 34,W
00BE: IORLW 80
00BF: MOVWF 35
00C0: CLRF 36
00C1: MOVF 35,W
00C2: MOVWF 37
00C3: CALL 04E
.................... }
00C4: RETLW 00
....................
....................
.................... // Zapis znaku na displej, zpracovani ridicich znaku
.................... //
.................... void lcd_putc( char c)
.................... {
....................
.................... switch (c)
.................... {
00C5: MOVF 31,W
00C6: XORLW 0C
00C7: BTFSC 03.2
00C8: GOTO 0D3
00C9: XORLW 06
00CA: BTFSC 03.2
00CB: GOTO 0DB
00CC: XORLW 07
00CD: BTFSC 03.2
00CE: GOTO 0E1
00CF: XORLW 05
00D0: BTFSC 03.2
00D1: GOTO 0E6
00D2: GOTO 0EB
.................... case '\f' : lcd_send_byte(0,1); // smaz displej
00D3: CLRF 36
00D4: MOVLW 01
00D5: MOVWF 37
00D6: CALL 04E
.................... delay_ms(2);
00D7: MOVLW 02
00D8: MOVWF 32
00D9: CALL 024
.................... break;
00DA: GOTO 0F7
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
00DB: MOVLW 01
00DC: MOVWF 32
00DD: MOVLW 02
00DE: MOVWF 33
00DF: CALL 0B4
00E0: GOTO 0F7
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home
00E1: MOVLW 01
00E2: MOVWF 32
00E3: MOVWF 33
00E4: CALL 0B4
00E5: GOTO 0F7
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
00E6: CLRF 36
00E7: MOVLW 10
00E8: MOVWF 37
00E9: CALL 04E
00EA: GOTO 0F7
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
00EB: MOVF 31,W
00EC: SUBLW 1F
00ED: BTFSS 03.0
00EE: GOTO 0F1
00EF: MOVLW 07
00F0: ANDWF 31,F
.................... lcd_send_byte(1,c); break; // zapis znak
00F1: MOVLW 01
00F2: MOVWF 36
00F3: MOVF 31,W
00F4: MOVWF 37
00F5: CALL 04E
00F6: GOTO 0F7
.................... }
.................... }
00F7: RETLW 00
....................
....................
.................... // Zapni kurzor
.................... //
.................... void lcd_cursor_on()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_ON_);
.................... }
....................
....................
.................... // Vypni kurzor
.................... //
.................... void lcd_cursor_off()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_OFF_);
.................... }
....................
....................
.................... // Smaz displej
.................... //
.................... void lcd_clr()
.................... {
.................... lcd_putc('\f');
.................... }
....................
....................
.................... // Definice vlastnich fontu
.................... //
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
.................... // priklad pouziti definovanych znaku.
....................
....................
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje
.................... //
.................... void lcd_putc2(int Data)
.................... {
.................... lcd_send_byte(1,Data);
.................... }
....................
....................
.................... // Pomocne definice pro programovani obsahu CGRAM
.................... //
.................... #define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
.................... #define lcd_define_def(String) printf(lcd_putc2,String);
.................... #define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
....................
....................
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
.................... //
.................... #define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
....................
....................
.................... // Pripravene definice fontu vybranych znaku
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
.................... //
.................... #define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
.................... #define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
.................... #define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
.................... #define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
.................... #define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
.................... #define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
.................... #define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
.................... #define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
.................... #define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
.................... #define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
.................... #define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
.................... #define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
.................... #define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
.................... #define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
.................... #define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
.................... #define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
.................... #define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
.................... #define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
.................... #define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
.................... #define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
.................... #define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
.................... #define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
.................... #define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
.................... #define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
.................... #define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
.................... #define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
.................... #define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
.................... #define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
.................... #define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
.................... #define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
.................... #define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
.................... #define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
.................... #define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
.................... #define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
.................... #define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
....................
....................
.................... // Priklad pouziti definovanych znaku
.................... //
.................... //
.................... //void lcd_sample()
.................... //{
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
.................... // // jediny definicni retezec)
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
.................... // delay_ms(1000);
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
.................... // delay_ms(1000);
.................... //}
....................
....................
.................... #define DATA PIN_A1
.................... #define CP PIN_A0
.................... #define STROBE PIN_A2
....................
.................... #include "C:\library\kaklik\ccs\shift_reg.c"
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // KNIHOVNA PRO OVLADANI POSUVNEHO REGISTRU
.................... //
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // definice:
.................... //#define DATA PIN_A1
.................... //#define CP PIN_A0
.................... //#define STROBE PIN_A2
....................
.................... void putreg(unsigned int8 out) // zapise do registru 8bitovou promenou.
.................... {
.................... int8 i;
.................... output_low(STROBE);
....................
.................... for(i=0;i<=7;i++)
.................... {
.................... output_bit(DATA,bit_test(out,7-i));
.................... output_low(CP);
.................... output_high(CP);
.................... }
.................... output_high(STROBE);
.................... }
....................
.................... void reg_shift_left()
.................... {
.................... output_low(CP);
.................... output_high(CP);
....................
.................... }
....................
.................... void reg_shift_right()
.................... {
.................... }
....................
....................
.................... void main()
.................... {
*
0158: CLRF 04
0159: MOVLW 1F
015A: ANDWF 03,F
015B: BSF 03.5
015C: BSF 1F.0
015D: BSF 1F.1
015E: BSF 1F.2
015F: BCF 1F.3
.................... unsigned int16 otacky;
....................
.................... setup_adc_ports(NO_ANALOGS);
*
0163: BSF 03.5
0164: BSF 1F.0
0165: BSF 1F.1
0166: BSF 1F.2
0167: BCF 1F.3
.................... setup_adc(ADC_OFF);
0168: BCF 03.5
0169: BCF 1F.0
.................... setup_spi(FALSE);
*
0160: MOVLW FF
0161: BCF 03.5
0162: MOVWF 25
*
016A: BCF 14.5
016B: BCF 25.5
016C: MOVF 25,W
016D: BSF 03.5
016E: MOVWF 07
016F: BCF 03.5
0170: BSF 25.4
0171: MOVF 25,W
0172: BSF 03.5
0173: MOVWF 07
0174: BCF 03.5
0175: BCF 25.3
0176: MOVF 25,W
0177: BSF 03.5
0178: MOVWF 07
0179: MOVLW 00
017A: BCF 03.5
017B: MOVWF 14
017C: BSF 03.5
017D: MOVWF 14
.................... setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
017E: MOVF 01,W
017F: ANDLW C7
0180: IORLW 38
0181: MOVWF 01
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_2);
0182: MOVLW 97
0183: BCF 03.5
0184: MOVWF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0185: MOVLW 00
0186: MOVWF 21
0187: MOVWF 12
0188: MOVLW 00
0189: BSF 03.5
018A: MOVWF 12
.................... setup_ccp1(CCP_PWM);
018B: BCF 03.5
018C: BCF 25.2
018D: MOVF 25,W
018E: BSF 03.5
018F: MOVWF 07
0190: BCF 03.5
0191: BCF 07.2
0192: MOVLW 0C
0193: MOVWF 17
.................... setup_ccp2(CCP_OFF);
0194: BSF 25.1
0195: MOVF 25,W
0196: BSF 03.5
0197: MOVWF 07
0198: BCF 03.5
0199: CLRF 1D
019A: CLRF 1D
....................
.................... lcd_init();
019B: GOTO 064
....................
.................... while (true)
.................... {
.................... set_timer1(0);
019C: CLRF 0F
019D: CLRF 0E
....................
.................... Delay_ms(500);
019E: MOVLW 02
019F: MOVWF 28
01A0: MOVLW FA
01A1: MOVWF 32
01A2: CALL 024
01A3: DECFSZ 28,F
01A4: GOTO 1A0
.................... otacky=get_timer1();
01A5: MOVF 0F,W
01A6: MOVWF 23
01A7: MOVF 0E,W
01A8: MOVWF 20
01A9: MOVF 0F,W
01AA: SUBWF 23,W
01AB: BTFSS 03.2
01AC: GOTO 1A5
01AD: MOVF 20,W
01AE: MOVWF 26
01AF: MOVF 23,W
01B0: MOVWF 27
.................... otacky=otacky*40;
01B1: MOVF 27,W
01B2: MOVWF 29
01B3: MOVF 26,W
01B4: MOVWF 28
01B5: CLRF 2B
01B6: MOVLW 28
01B7: MOVWF 2A
01B8: GOTO 09E
01B9: MOVF 22,W
01BA: MOVWF 27
01BB: MOVF 21,W
01BC: MOVWF 26
....................
.................... switch(otacky)
.................... {
01BD: MOVF 26,W
01BE: MOVWF 20
01BF: MOVF 27,W
01C0: MOVWF 23
01C1: GOTO 1C2
....................
.................... }
....................
.................... LCD_gotoxy(2,2);
01C2: MOVLW 02
01C3: MOVWF 32
01C4: MOVWF 33
01C5: CALL 0B4
.................... printf(lcd_putc,"otacky:%lu ot/min ",otacky);
01C6: CLRF 28
01C7: MOVF 28,W
01C8: CALL 00C
01C9: INCF 28,F
01CA: MOVWF 20
01CB: MOVWF 31
01CC: CALL 0C5
01CD: MOVLW 07
01CE: SUBWF 28,W
01CF: BTFSS 03.2
01D0: GOTO 1C7
01D1: MOVLW 10
01D2: MOVWF 04
01D3: MOVF 27,W
01D4: MOVWF 2A
01D5: MOVF 26,W
01D6: MOVWF 29
01D7: GOTO 0F8
01D8: MOVLW 0A
01D9: MOVWF 29
01DA: MOVF 29,W
01DB: CALL 00C
01DC: INCF 29,F
01DD: MOVWF 20
01DE: MOVWF 31
01DF: CALL 0C5
01E0: MOVLW 13
01E1: SUBWF 29,W
01E2: BTFSS 03.2
01E3: GOTO 1DA
.................... }
01E4: GOTO 19C
....................
.................... }
....................
01E5: SLEEP
 
Configuration Fuses:
Word 1: 3F79 XT NOWDT NOPUT NOPROTECT BROWNOUT NOLVP NOCPD NOWRT NODEBUG
/programy/C/PIC/mereni/otmer/16F873/otmer.PJT
0,0 → 1,39
[PROJECT]
Target=otmer.HEX
Development_Mode=
Processor=0x873F
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\drivers\;C:\library\CCS;
Library=
LinkerScript=
 
[Target Data]
FileList=otmer.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[otmer.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=otmer.c
 
[Windows]
0=0000 otmer.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.c
2=D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h
3=C:\Program Files\PICC\devices\16F873.h
4=D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\LCD.C
5=C:\library\kaklik\ccs\shift_reg.c
6=
/programy/C/PIC/mereni/otmer/16F873/otmer.SYM
0,0 → 1,75
015 CCP_1_LOW
015-016 CCP_1
016 CCP_1_HIGH
01B CCP_2_LOW
01B-01C CCP_2
01C CCP_2_HIGH
020 @SCRATCH
021 @SCRATCH
021 _RETURN_
022 @SCRATCH
023 @SCRATCH
024 @SCRATCH
025 @TRIS_C
026-027 main.otacky
028 lcd_init.i
028-029 @MUL1616.P1
028 main.@SCRATCH
029-02A @PRINTF_LU_263.P1
029 lcd_init.@SCRATCH
029 main.@SCRATCH
02A-02B @MUL1616.P1
02B @PRINTF_LU_263.@SCRATCH
02C @MUL1616.@SCRATCH
02C @PRINTF_LU_263.@SCRATCH
02D @PRINTF_LU_263.@SCRATCH
02E @PRINTF_LU_263.@SCRATCH
02F @PRINTF_LU_263.@SCRATCH
030 @PRINTF_LU_263.@SCRATCH
031 lcd_putc.c
032 @delay_ms1.P1
032 lcd_gotoxy.x
033 lcd_gotoxy.y
034 lcd_gotoxy.Adr
035 lcd_gotoxy.@SCRATCH
036 lcd_send_byte.Adr
037 lcd_send_byte.n
038 lcd_send_nibble.n
039 lcd_send_nibble.@SCRATCH
03A lcd_send_nibble.@SCRATCH
 
0024 @delay_ms1
0004 @const28
0039 lcd_send_nibble
004E lcd_send_byte
0064 lcd_init
00B4 lcd_gotoxy
00C5 lcd_putc
0158 main
009E @MUL1616
000C @const10134
00F8 @PRINTF_LU_263
0158 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.c
D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h
C:\Program Files\PICC\devices\16F873.h
D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\LCD.C
C:\library\kaklik\ccs\shift_reg.c
 
Compiler Settings:
Processor: PIC16F873
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.HEX
Symbols: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.SYM
List: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.LST
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.sta
/programy/C/PIC/mereni/otmer/16F873/otmer.c
0,0 → 1,49
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h"
 
//Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
 
#include "LCD.C"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "C:\library\kaklik\ccs\shift_reg.c"
 
void main()
{
unsigned int16 otacky;
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_2);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_OFF);
 
lcd_init();
 
while (true)
{
set_timer1(0);
 
Delay_ms(500);
otacky=get_timer1();
otacky=otacky*40;
switch(otacky)
{
}
 
LCD_gotoxy(2,2);
printf(lcd_putc,"otacky:%lu ot/min ",otacky);
}
 
}
/programy/C/PIC/mereni/otmer/16F873/otmer.cof
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
/programy/C/PIC/mereni/otmer/16F873/otmer.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/otmer/16F873/otmer.h
0,0 → 1,5
#include <16F873.h>
#device adc=8
#fuses NOWDT,XT, NOPUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use delay(clock=4000000)
 
/programy/C/PIC/mereni/otmer/16F873/otmer.sta
0,0 → 1,40
 
ROM used: 486 (12%)
486 (12%) including unused fragments
 
1 Average locations per line
7 Average locations per statement
 
RAM used: 10 (5%) at main() level
27 (14%) worst case
 
Lines Stmts % Files
----- ----- --- -----
50 18 24 D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.c
6 0 0 D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h
240 0 0 C:\Program Files\PICC\devices\16F873.h
312 47 51 D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\LCD.C
34 9 6 C:\library\kaklik\ccs\shift_reg.c
----- -----
1284 148 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 4 1 @delay_ms1
0 8 2 0 @const28
0 21 4 3 lcd_send_nibble
0 22 5 2 lcd_send_byte
0 58 12 2 lcd_init
0 17 3 4 lcd_gotoxy
0 51 10 1 lcd_putc
0 142 29 4 main
0 22 5 5 @MUL1616
0 24 5 0 @const10134
0 96 20 8 @PRINTF_LU_263
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 482 1562
00800-00FFF 0 2048
 
/programy/C/PIC/mereni/otmer/16F873/otmer.tre
0,0 → 1,98
ÀÄotmer
ÀÄmain 0/142 Ram=4
ÃÄ??0??
ÃÄlcd_init 0/58 Ram=2
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@const28 0/8 Ram=0
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@MUL1616 0/22 Ram=5
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10134 0/24 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@PRINTF_LU_263 0/96 Ram=8
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10134 0/24 Ram=0
ÀÄlcd_putc 0/51 Ram=1
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÀÄlcd_send_byte 0/22 Ram=2
ÃÄlcd_send_nibble 0/21 Ram=3
ÀÄlcd_send_nibble 0/21 Ram=3
/programy/C/PIC/mereni/otmer/Kopie - otackomer.c
0,0 → 1,27
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otackomer.h"
 
#define DATA PIN_A1
#define CP PIN_A0
 
void main()
{
int i;
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
 
while(true)
{
output_high(DATA);
output_high(CP);
Delay_ms(100);
output_low(CP);
output_low(DATA);
 
for(i=7;i>0;i--)
{
Delay_ms(100);
output_high(CP);
Delay_ms(100);
output_low(CP);
}
}
}
/programy/C/PIC/mereni/otmer/Kopie - otmer.c
0,0 → 1,38
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "shift_reg.c"
 
void main()
{
int n=0;
int i;
putreg(1);
while(true)
{
i=1;
for(n=0;n<=7;n++)
{
putreg(i);
i=i<<1;
Delay_ms(50);
};
i=0x80;
for(n=0;n<=7;n++)
{
putreg(i);
i=i>>1;
Delay_ms(50);
};
}
 
while(true)
{
putreg(~n);
Delay_ms(100);
n++;
}
}
/programy/C/PIC/mereni/otmer/otmer.BAK
0,0 → 1,38
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "shift_reg.c"
 
void main()
{
int n=0;
int i;
putreg(1);
while(true)
{
i=1;
for(n=0;n<=7;n++)
{
putreg(~i);
i=i<<1;
Delay_ms(50);
};
i=0x80;
for(n=0;n<=7;n++)
{
putreg(~i);
i=i>>1;
Delay_ms(50);
};
}
 
while(true)
{
putreg(~n);
Delay_ms(100);
n++;
}
}
/programy/C/PIC/mereni/otmer/otmer.HEX
0,0 → 1,19
:1000000000308A0044280000831605118312051170
:1000100093011308073C031C2A281308073C94008B
:1000200012088C0014088D0003191A2803108C0C78
:100030008D0B16280C181E2885101F288514831672
:100040008510051083120510831605108312051400
:10005000930A0928831605118312051500341130FF
:10006000840000080319432801308D008C018C0B9B
:1000700037288D0B36284A308C008C0B3D28000029
:100080000000800B3428003484011F3083058F0169
:10009000013092000420013090008F010F08073CCE
:1000A000031C5C281008920004200310900D3230CD
:1000B00091002F208F0A4E28803090008F010F086A
:1000C000073C031C6D281008920004200310900CBC
:1000D000323091002F208F0A5F284B280F089100A3
:1000E0009109110892000420643091002F208F0A9A
:0400F0006E28630013
:02400E00F93F78
:00000001FF
;PIC16F84
/programy/C/PIC/mereni/otmer/otmer.LST
0,0 → 1,216
CCS PCM C Compiler, Version 3.221, 27853 14-VI-05 22:12
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.LST
 
ROM used: 122 words (12%)
Largest free fragment is 902
RAM used: 5 (7%) at main() level
8 (12%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 044
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #fuses NOWDT,XT, NOPUT, NOPROTECT
.................... #use delay(clock=4000000)
*
002F: MOVLW 11
0030: MOVWF 04
0031: MOVF 00,W
0032: BTFSC 03.2
0033: GOTO 043
0034: MOVLW 01
0035: MOVWF 0D
0036: CLRF 0C
0037: DECFSZ 0C,F
0038: GOTO 037
0039: DECFSZ 0D,F
003A: GOTO 036
003B: MOVLW 4A
003C: MOVWF 0C
003D: DECFSZ 0C,F
003E: GOTO 03D
003F: NOP
0040: NOP
0041: DECFSZ 00,F
0042: GOTO 034
0043: RETLW 00
....................
....................
....................
.................... #define DATA PIN_A1
.................... #define CP PIN_A0
.................... #define STROBE PIN_A2
....................
.................... #include "shift_reg.c"
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // KNIHOVNA PRO OVLADANI POSUVNEHO REGISTRU
.................... //
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // definice
.................... //#define DATA PIN_A1
.................... //#define CP PIN_A0
.................... //#define STROBE PIN_A2
....................
.................... void putreg(unsigned int8 out) // zapise do registru 8bitovou promenou.
.................... {
.................... int8 i;
.................... output_low(STROBE);
*
0004: BSF 03.5
0005: BCF 05.2
0006: BCF 03.5
0007: BCF 05.2
....................
.................... for(i=0;i<=7;i++)
0008: CLRF 13
0009: MOVF 13,W
000A: SUBLW 07
000B: BTFSS 03.0
000C: GOTO 02A
.................... {
.................... output_bit(DATA,bit_test(out,7-i));
000D: MOVF 13,W
000E: SUBLW 07
000F: MOVWF 14
0010: MOVF 12,W
0011: MOVWF 0C
0012: MOVF 14,W
0013: MOVWF 0D
0014: BTFSC 03.2
0015: GOTO 01A
0016: BCF 03.0
0017: RRF 0C,F
0018: DECFSZ 0D,F
0019: GOTO 016
001A: BTFSC 0C.0
001B: GOTO 01E
001C: BCF 05.1
001D: GOTO 01F
001E: BSF 05.1
001F: BSF 03.5
0020: BCF 05.1
.................... output_low(CP);
0021: BCF 05.0
0022: BCF 03.5
0023: BCF 05.0
.................... output_high(CP);
0024: BSF 03.5
0025: BCF 05.0
0026: BCF 03.5
0027: BSF 05.0
.................... }
0028: INCF 13,F
0029: GOTO 009
.................... output_high(STROBE);
002A: BSF 03.5
002B: BCF 05.2
002C: BCF 03.5
002D: BSF 05.2
.................... }
002E: RETLW 00
.................... void reg_shift_left()
.................... {
.................... }
.................... void reg_shift_right()
.................... {
.................... }
....................
....................
.................... void main()
.................... {
*
0044: CLRF 04
0045: MOVLW 1F
0046: ANDWF 03,F
.................... int n=0;
0047: CLRF 0F
.................... int i;
.................... putreg(1);
0048: MOVLW 01
0049: MOVWF 12
004A: CALL 004
.................... while(true)
.................... {
.................... i=1;
004B: MOVLW 01
004C: MOVWF 10
.................... for(n=0;n<=7;n++)
004D: CLRF 0F
004E: MOVF 0F,W
004F: SUBLW 07
0050: BTFSS 03.0
0051: GOTO 05C
.................... {
.................... putreg(i);
0052: MOVF 10,W
0053: MOVWF 12
0054: CALL 004
.................... i=i<<1;
0055: BCF 03.0
0056: RLF 10,F
.................... Delay_ms(50);
0057: MOVLW 32
0058: MOVWF 11
0059: CALL 02F
.................... };
005A: INCF 0F,F
005B: GOTO 04E
.................... i=0x80;
005C: MOVLW 80
005D: MOVWF 10
.................... for(n=0;n<=7;n++)
005E: CLRF 0F
005F: MOVF 0F,W
0060: SUBLW 07
0061: BTFSS 03.0
0062: GOTO 06D
.................... {
.................... putreg(i);
0063: MOVF 10,W
0064: MOVWF 12
0065: CALL 004
.................... i=i>>1;
0066: BCF 03.0
0067: RRF 10,F
.................... Delay_ms(50);
0068: MOVLW 32
0069: MOVWF 11
006A: CALL 02F
.................... };
006B: INCF 0F,F
006C: GOTO 05F
.................... }
006D: GOTO 04B
....................
.................... while(true)
.................... {
.................... putreg(~n);
006E: MOVF 0F,W
006F: MOVWF 11
0070: COMF 11,F
0071: MOVF 11,W
0072: MOVWF 12
0073: CALL 004
.................... Delay_ms(100);
0074: MOVLW 64
0075: MOVWF 11
0076: CALL 02F
.................... n++;
0077: INCF 0F,F
.................... }
0078: GOTO 06E
.................... }
....................
0079: SLEEP
 
Configuration Fuses:
Word 1: 3FF9 XT NOWDT NOPUT NOPROTECT
/programy/C/PIC/mereni/otmer/otmer.PJT
0,0 → 1,38
[PROJECT]
Target=otmer.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=otmer.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[otmer.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=otmer.c
 
[Windows]
0=0000 otmer.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.c
2=D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h
3=C:\Program Files\PICC\devices\16F84.h
4=
5=
/programy/C/PIC/mereni/otmer/otmer.SYM
0,0 → 1,36
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F main.n
010 main.i
011 @delay_ms1.P1
011 main.@SCRATCH
012 putreg.out
013 putreg.i
014 putreg.@SCRATCH
 
002F @delay_ms1
0004 putreg
0044 main
0044 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.c
D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h
C:\Program Files\PICC\devices\16F84.h
D:\KAKLIK\programy\PIC_C\mereni\otmer\shift_reg.c
 
Compiler Settings:
Processor: PIC16F84
Pointer Size: 8
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.HEX
Symbols: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.SYM
List: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.LST
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.sta
/programy/C/PIC/mereni/otmer/otmer.c
0,0 → 1,38
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "shift_reg.c"
 
void main()
{
int n=0;
int i;
putreg(1);
while(true)
{
i=1;
for(n=0;n<=7;n++)
{
putreg(i);
i=i<<1;
Delay_ms(50);
};
i=0x80;
for(n=0;n<=7;n++)
{
putreg(i);
i=i>>1;
Delay_ms(50);
};
}
 
while(true)
{
putreg(~n);
Delay_ms(100);
n++;
}
}
/programy/C/PIC/mereni/otmer/otmer.cof
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
/programy/C/PIC/mereni/otmer/otmer.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/otmer/otmer.h
0,0 → 1,4
#include <16F84.h>
#fuses NOWDT,XT, NOPUT, NOPROTECT
#use delay(clock=4000000)
 
/programy/C/PIC/mereni/otmer/otmer.sta
0,0 → 1,30
 
ROM used: 122 (12%)
122 (12%) including unused fragments
 
1 Average locations per line
4 Average locations per statement
 
RAM used: 5 (7%) at main() level
8 (12%) worst case
 
Lines Stmts % Files
----- ----- --- -----
39 22 76 D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.c
5 0 0 D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h
111 0 0 C:\Program Files\PICC\devices\16F84.h
29 7 14 D:\KAKLIK\programy\PIC_C\mereni\otmer\shift_reg.c
----- -----
368 58 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 17 1 @delay_ms1
0 43 35 3 putreg
0 54 44 3 main
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-003FF 118 902
 
/programy/C/PIC/mereni/otmer/otmer.tre
0,0 → 1,10
ÀÄotmer
ÀÄmain 0/54 Ram=3
ÃÄ??0??
ÃÄputreg 0/43 Ram=3
ÃÄputreg 0/43 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄputreg 0/43 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄputreg 0/43 Ram=3
ÀÄ@delay_ms1 0/21 Ram=1
/programy/C/PIC/mereni/otmer/shift_reg.BAK
0,0 → 1,22
////////////////////////////////////////////////////////////////////////////////
// KNIHOVNA PRO OVLADANI POSUVNEHO REGISTRU
//
////////////////////////////////////////////////////////////////////////////////
// definice
//#define DATA PIN_A1
//#define CP PIN_A0
//#define STROBE PIN_A2
 
void putreg(unsigned int8 out) // zapise do registru 8bitovou promenou.
{
int8 i;
output_low(STROBE);
for(i=0;i<=7;i++)
{
output_bit(DATA,bit_test(out,7-i));
output_low(CP);
output_high(CP);
}
output_high(STROBE);
}
/programy/C/PIC/mereni/otmer/vssver.scc
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
/programy/C/PIC/mereni/piezo_cidlo/PRG.BAT
0,0 → 1,10
@echo off
picpgr reset PIC16F84
picpgr erase PIC16F84
 
rem cls
picpgr program piezo.hex hex PIC16f84 XT_ON PWRTE_ON WDTE_OFF CP_OFF
picpgr run
pause
picpgr stop
pause
/programy/C/PIC/mereni/piezo_cidlo/PRG.PIF
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
/programy/C/PIC/mereni/piezo_cidlo/RUN.PIF
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
/programy/C/PIC/mereni/piezo_cidlo/Run.BAT
0,0 → 1,6
@echo off
picpgr reset PIC16F84
picpgr run
pause
picpgr stop
pause
/programy/C/PIC/mereni/piezo_cidlo/piezo.BAK
0,0 → 1,13
#include "D:\@Kaklik\programy\PIC_C\cidlo\piezo.h"
 
 
void main()
{
port_b_pullups(false);
setup_counters(RTCC_INTERNAL,WDT_18MS);
 
while (true)
{
if (input(PIN_B0)) output_high(PIN_A3); else output_low(PIN_A3);
}
}
/programy/C/PIC/mereni/piezo_cidlo/piezo.HEX
0,0 → 1,13
:1000000000308A001928000010308400000803190D
:10001000182801308D008C018C0B0C288D0B0B28BF
:100020004A308C008C0B122800000000800B09283D
:10003000402884011F3083058316811708308312FE
:100040008C008C1D2B280730810181308400000832
:10005000C0390F3880006400813084000008C03946
:100060000C048000831606148312061C4328831692
:1000700085118312851502308F00FA309000042814
:100080008F0B3D284728831685118312851132284E
:0200900063000B
:02400E00FE3F73
:00000001FF
;PIC16C84
/programy/C/PIC/mereni/piezo_cidlo/piezo.LST
0,0 → 1,112
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\cidlo\piezo.LST
 
ROM used: 73 (7%)
Largest free fragment is 951
RAM used: 3 (8%) at main() level
4 (11%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 019
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\cidlo\piezo.h"
.................... #include <16C84.h>
.................... //////// Standard Header file for the PIC16C84 device ////////////////
.................... #device PIC16C84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 10
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: GOTO 040 (RETURN)
.................... #fuses HS,WDT
....................
....................
....................
....................
.................... void main()
.................... {
0019: CLRF 04
001A: MOVLW 1F
001B: ANDWF 03,F
.................... port_b_pullups(false);
001C: BSF 03.5
001D: BSF 01.7
.................... setup_counters(RTCC_INTERNAL,WDT_18MS);
001E: MOVLW 08
001F: BCF 03.5
0020: MOVWF 0C
0021: BTFSS 0C.3
0022: GOTO 02B
0023: MOVLW 07
0024: CLRF 01
0025: MOVLW 81
0026: MOVWF 04
0027: MOVF 00,W
0028: ANDLW C0
0029: IORLW 0F
002A: MOVWF 00
002B: CLRWDT
002C: MOVLW 81
002D: MOVWF 04
002E: MOVF 00,W
002F: ANDLW C0
0030: IORWF 0C,W
0031: MOVWF 00
....................
.................... while (true)
.................... {
.................... if (input(PIN_B0))
0032: BSF 03.5
0033: BSF 06.0
0034: BCF 03.5
0035: BTFSS 06.0
0036: GOTO 043
.................... {
.................... output_high(PIN_A3);
0037: BSF 03.5
0038: BCF 05.3
0039: BCF 03.5
003A: BSF 05.3
.................... delay_ms(500);
003B: MOVLW 02
003C: MOVWF 0F
003D: MOVLW FA
003E: MOVWF 10
003F: GOTO 004
0040: DECFSZ 0F,F
0041: GOTO 03D
.................... }
.................... else output_low(PIN_A3);
0042: GOTO 047
0043: BSF 03.5
0044: BCF 05.3
0045: BCF 03.5
0046: BCF 05.3
.................... }
0047: GOTO 032
.................... }
....................
0048: SLEEP
/programy/C/PIC/mereni/piezo_cidlo/piezo.PJT
0,0 → 1,32
[PROJECT]
Target=piezo.HEX
Development_Mode=
Processor=0x6C84
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=piezo.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[piezo.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=piezo.c
 
[Windows]
0=0000 piezo.c 0 0 796 451 3 0
 
/programy/C/PIC/mereni/piezo_cidlo/piezo.SYM
0,0 → 1,14
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F main.@SCRATCH
010 delay_ms.P1
delay_us.P1
 
0004 delay_ms
0019 main
 
Project Files:
d:\@kaklik\programy\pic_c\cidlo\piezo.c
D:\@Kaklik\programy\PIC_C\cidlo\piezo.h
C:\PROGRAM FILES\PICC\devices\16C84.h
/programy/C/PIC/mereni/piezo_cidlo/piezo.c
0,0 → 1,18
#include "D:\@Kaklik\programy\PIC_C\cidlo\piezo.h"
 
 
void main()
{
port_b_pullups(false);
setup_counters(RTCC_INTERNAL,WDT_18MS);
 
while (true)
{
if (input(PIN_B0))
{
output_high(PIN_A3);
delay_ms(500);
}
else output_low(PIN_A3);
}
}
/programy/C/PIC/mereni/piezo_cidlo/piezo.cod
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
/programy/C/PIC/mereni/piezo_cidlo/piezo.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/piezo_cidlo/piezo.h
0,0 → 1,4
#include <16C84.h>
#use delay(clock=4000000)
#fuses HS,WDT
 
/programy/C/PIC/mereni/piezo_cidlo/piezo.sta
0,0 → 1,28
 
ROM used: 73 (7%)
951 (93%) including unused fragments
 
1 Average locations per line
8 Average locations per statement
 
RAM used: 3 (8%) at main() level
4 (11%) worst case
 
Lines Stmts % Files
----- ----- --- -----
19 9 100 d:\@kaklik\programy\pic_c\cidlo\piezo.c
5 0 0 D:\@Kaklik\programy\PIC_C\cidlo\piezo.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16C84.h
----- -----
270 18 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 29 1 delay_ms
0 48 66 1 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 69 951
 
/programy/C/PIC/mereni/piezo_cidlo/piezo.tre
0,0 → 1,4
ÀÄpiezo
ÀÄmain 0/48 Ram=1
ÃÄ??0??
ÀÄdelay_ms 0/21 Ram=1
/programy/C/PIC/mereni/piezo_cidlo/vssver.scc
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
/programy/C/PIC/mereni/vyskomer_drak/main.BAK
0,0 → 1,21
#include "D:\@Kaklik\programy\PIC_C\mereni\vyskomer_drak\main.h"
 
#DEFINE SCLK PIN_A2
#DEFINE DOUT
#DEFINE DIN PIN_A1
#include "MS5534A.c"
void main()
{
output_high(pin_B2);
while(true)
{
while(!input(pin_B1))
{
output_high(pin_A3);
Delay_ms(50);
}
output_low(pin_A3);
Delay_ms(50);
}
 
}
/programy/C/PIC/mereni/vyskomer_drak/main.HEX
0,0 → 1,10
:1000000000308A001928000012308400000803190B
:10001000182801308D008C018C0B0C288D0B0B28BF
:100020004A308C008C0B122800000000800B09283D
:10003000003484011F3083058316061183120615D0
:1000400083168614831286182D2883168511831231
:1000500085153230920004202028831685118312E2
:0C0060008511323092000420202863003B
:02400E00F93F78
:00000001FF
;PIC16F84
/programy/C/PIC/mereni/vyskomer_drak/main.LST
0,0 → 1,204
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\mereni\vyskomer_drak\main.LST
 
ROM used: 54 (5%)
Largest free fragment is 970
RAM used: 5 (7%) at main() level
6 (9%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 019
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\mereni\vyskomer_drak\main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 12
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: RETLW 00
.................... #fuses XT,NOWDT
....................
....................
....................
.................... #DEFINE SCLK PIN_A2
.................... #DEFINE DOUT PIN_A3
.................... #DEFINE DIN PIN_A1
.................... #include "MS5534A.c"
....................
.................... #DEFINE CLK 250
.................... #DEFINE WORD1 0b111010101000
.................... #DEFINE WORD2 0b111010110000
.................... #DEFINE WORD3 0b111011001000
.................... #DEFINE WORD4 0b111011010000
....................
.................... void send_bit(bit)
.................... {
.................... output_bit(DIN,bit);
.................... output_high(SCLK);
.................... Delay_us(CLK);
.................... output_low(SCLK);
.................... }
.................... int1 read_bit()
.................... {
.................... output_high(SCLK);
.................... Delay_us(CLK);
.................... output_low(SCLK);
.................... if (input(DOUT)) return true;
.................... if (!input(DOUT)) return false;
.................... }
....................
.................... void read_byte(*byte_r)
.................... {
.................... int i;
....................
.................... for(i=0;i>=7;i++)
.................... {
.................... *byte_r = read_bit();
.................... *byte_r << 1;
.................... }
.................... }
....................
.................... void send_command(command,width)
.................... {
.................... int i;
.................... for (i=width;i>=0;i--)
.................... {
.................... send_bit(bit_test(command,0));
.................... command >>1;
.................... }
.................... }
....................
.................... void bar_reset()
.................... {
.................... int8 i;
....................
.................... for(i=0;i>=20;i++) send_bit(Bit_test(i,0));
.................... }
....................
.................... int16 bar_con_pre()
.................... {
.................... int16 word;
....................
.................... send_command(0b1111010000,9);
....................
.................... Delay_ms(10);
....................
.................... While(input(DOUT)) Delay_us(100);
....................
.................... read_byte(&word);
.................... word << 8;
.................... read_byte(&word);
....................
.................... return word;
.................... }
....................
.................... int16 bar_con_term()
.................... {
.................... int16 word;
....................
.................... send_command(0b1111001000,9);
....................
.................... Delay_ms(10);
....................
.................... While(input(DOUT)) Delay_us(100);
....................
.................... read_byte(&word);
.................... word << 8;
.................... read_byte(&word);
....................
.................... return word;
.................... }
....................
.................... int16 bar_read_cal(command)
.................... {
.................... int16 word;
....................
.................... send_command(command,11);
....................
.................... Delay_ms(10);
....................
.................... While(input(DOUT)) Delay_us(100);
....................
.................... read_byte(&word);
.................... word << 8;
.................... read_byte(&word);
....................
.................... return word;
.................... }
....................
....................
....................
....................
....................
....................
....................
.................... void main()
.................... {
0019: CLRF 04
001A: MOVLW 1F
001B: ANDWF 03,F
.................... output_high(pin_B2);
001C: BSF 03.5
001D: BCF 06.2
001E: BCF 03.5
001F: BSF 06.2
.................... while(true)
.................... {
.................... while(!input(pin_B1))
0020: BSF 03.5
0021: BSF 06.1
0022: BCF 03.5
0023: BTFSC 06.1
0024: GOTO 02D
.................... {
.................... output_high(pin_A3);
0025: BSF 03.5
0026: BCF 05.3
0027: BCF 03.5
0028: BSF 05.3
.................... Delay_ms(50);
0029: MOVLW 32
002A: MOVWF 12
002B: CALL 004
.................... }
002C: GOTO 020
.................... output_low(pin_A3);
002D: BSF 03.5
002E: BCF 05.3
002F: BCF 03.5
0030: BCF 05.3
.................... Delay_ms(50);
0031: MOVLW 32
0032: MOVWF 12
0033: CALL 004
.................... }
0034: GOTO 020
....................
.................... }
....................
0035: SLEEP
/programy/C/PIC/mereni/vyskomer_drak/main.PJT
0,0 → 1,32
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
/programy/C/PIC/mereni/vyskomer_drak/main.SYM
0,0 → 1,28
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00E @SCRATCH
00F @SCRATCH
010 @SCRATCH
012 delay_ms.P1
delay_us.P1
send_bit.bit
read_byte.byte_r
read_byte.i
send_command.command
send_command.width
send_command.i
bar_reset.i
-000 bar_con_pre.word
-000 bar_con_term.word
bar_read_cal.command
-000 bar_read_cal.word
 
0004 delay_ms
0019 main
 
Project Files:
d:\@kaklik\programy\pic_c\mereni\vyskomer_drak\main.c
D:\@Kaklik\programy\PIC_C\mereni\vyskomer_drak\main.h
C:\PROGRAM FILES\PICC\devices\16F84.h
d:\@kaklik\programy\pic_c\mereni\vyskomer_drak\MS5534A.c
/programy/C/PIC/mereni/vyskomer_drak/main.c
0,0 → 1,21
#include "D:\@Kaklik\programy\PIC_C\mereni\vyskomer_drak\main.h"
 
#DEFINE SCLK PIN_A2
#DEFINE DOUT PIN_A3
#DEFINE DIN PIN_A1
#include "MS5534A.c"
void main()
{
output_high(pin_B2);
while(true)
{
while(!input(pin_B1))
{
output_high(pin_A3);
Delay_ms(50);
}
output_low(pin_A3);
Delay_ms(50);
}
 
}
/programy/C/PIC/mereni/vyskomer_drak/main.cod
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
/programy/C/PIC/mereni/vyskomer_drak/main.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/vyskomer_drak/main.h
0,0 → 1,4
#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,NOWDT
 
/programy/C/PIC/mereni/vyskomer_drak/main.sta
0,0 → 1,29
 
ROM used: 54 (5%)
970 (95%) including unused fragments
 
0 Average locations per line
1 Average locations per statement
 
RAM used: 5 (7%) at main() level
6 (9%) worst case
 
Lines Stmts % Files
----- ----- --- -----
22 9 17 d:\@kaklik\programy\pic_c\mereni\vyskomer_drak\main.c
5 0 0 D:\@Kaklik\programy\PIC_C\mereni\vyskomer_drak\main.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h
108 45 71 d:\@kaklik\programy\pic_c\mereni\vyskomer_drak\MS5534A.c
----- -----
492 108 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 39 1 delay_ms
0 29 54 0 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 50 970
 
/programy/C/PIC/mereni/vyskomer_drak/main.tre
0,0 → 1,5
ÀÄmain
ÀÄmain 0/29 Ram=0
ÃÄ??0??
ÃÄdelay_ms 0/21 Ram=1
ÀÄdelay_ms 0/21 Ram=1
/programy/C/PIC/mereni/vyskomer_drak/ms5534a.BAK
0,0 → 1,107
 
#DEFINE CLK 250
#DEFINE WORD1 0b111010101000
#DEFINE WORD2 0b111010110000
#DEFINE WORD3 0b111011001000
#DEFINE WORD4 0b111011010000
 
void send_bit(bit)
{
output_bit(DIN,bit);
output_high(SCLK);
Delay_us(CLK);
output_low(SCLK);
}
int1 read_bit()
{
output_high(SCLK);
Delay_us(CLK);
output_low(SCLK);
if (input(DOUT)) return true;
if (!input(DOUT)) return false;
}
 
void read_byte(*byte_r)
{
int i;
 
for(i=0;i>=7;i++)
{
*byte_r = read_bit();
*byte_r << 1;
}
}
 
void send_command(command,width)
{
int i;
for (i=width;i>=0;i--)
{
send_bit(bit_test(command,0));
command >>1;
}
}
 
void bar_reset()
{
int8 i;
 
for(i=0;i>=20;i++) send_bit(Bit_test(i,0));
}
 
int16 bar_con_pre()
{
int16 word;
send_command(0b1111010000,9);
 
Delay_ms(10);
 
While(input(DOUT)) Delay_us(100);
 
read_byte(&word);
word << 8;
read_byte(&word);
 
return word;
}
 
int16 bar_con_term()
{
int16 word;
 
send_command(0b1111001000,9);
 
Delay_ms(10);
 
While(input(DOUT)) Delay_us(100);
 
read_byte(&word);
word << 8;
read_byte(&word);
 
return word;
}
 
int16 bar_read_cal(command)
{
int16 word;
 
send_command(command,11);
 
Delay_ms(10);
 
While(input(DOUT)) Delay_us(100);
 
read_byte(&word);
word << 8;
read_byte(&word);
 
return word;
}
 
 
 
 
 
 
/programy/C/PIC/mereni/vyskomer_drak/ms5534a.c
0,0 → 1,107
 
#DEFINE CLK 250
#DEFINE WORD1 0b111010101000
#DEFINE WORD2 0b111010110000
#DEFINE WORD3 0b111011001000
#DEFINE WORD4 0b111011010000
 
void send_bit(bit)
{
output_bit(DIN,bit);
output_high(SCLK);
Delay_us(CLK);
output_low(SCLK);
}
int1 read_bit()
{
output_high(SCLK);
Delay_us(CLK);
output_low(SCLK);
if (input(DOUT)) return true;
if (!input(DOUT)) return false;
}
 
void read_byte(*byte_r)
{
int i;
 
for(i=0;i>=7;i++)
{
*byte_r = read_bit();
*byte_r << 1;
}
}
 
void send_command(command,width)
{
int i;
for (i=width;i>=0;i--)
{
send_bit(bit_test(command,0));
command >>1;
}
}
 
void bar_reset()
{
int8 i;
 
for(i=0;i>=20;i++) send_bit(Bit_test(i,0));
}
 
int16 bar_con_pre()
{
int16 word;
send_command(0b1111010000,9);
 
Delay_ms(10);
 
While(input(DOUT)) Delay_us(100);
 
read_byte(&word);
word << 8;
read_byte(&word);
 
return word;
}
 
int16 bar_con_term()
{
int16 word;
 
send_command(0b1111001000,9);
 
Delay_ms(10);
 
While(input(DOUT)) Delay_us(100);
 
read_byte(&word);
word << 8;
read_byte(&word);
 
return word;
}
 
int16 bar_read_cal(command)
{
int16 word;
 
send_command(command,11);
 
Delay_ms(10);
 
While(input(DOUT)) Delay_us(100);
 
read_byte(&word);
word << 8;
read_byte(&word);
 
return word;
}
 
 
 
 
 
 
/programy/C/PIC/mereni/vyskomer_drak/prg.bat
0,0 → 1,8
:start
call picpgr stop
call picpgr erase pic16f84
call picpgr program main.hex hex pic16f84
call picpgr run
pause
call picpgr stop
rem goto start
/programy/C/PIC/mereni/vyskomer_drak/run.bat
0,0 → 1,5
call picpgr run
pause
call picpgr stop
pause
run.bat
/programy/C/PIC/mereni/vyskomer_drak/vssver.scc
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
/programy/C/PIC/mereni/zavora/main.BAK
0,0 → 1,16
#include "D:\@Kaklik\programy\PIC_C\mereni\zavora\main.h"
 
 
void main()
{
output_high(PIN_A3);
Delay_ms(250);
output_low(PIN_A3);
Delay_ms(250);
while(true)
{
if(input(PIN_A4)) output_high(PIN_A3);
else output_low(PIN_A3);
}
}
/programy/C/PIC/mereni/zavora/main.HEX
0,0 → 1,11
:1000000000308A00192800000F308400000803190E
:10001000182801308D008C018C0B0C288D0B0B28BF
:100020004A308C008C0B122800000000800B09283D
:10003000003484011F3083058316851183128515D2
:10004000FA308F0004208316851183128511FA304F
:100050008F000420831605168312051E342883168C
:100060008511831285113828831685118312851511
:040070002A286300D7
:02400E00F93F78
:00000001FF
;PIC16F84
/programy/C/PIC/mereni/zavora/main.LST
0,0 → 1,95
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\mereni\zavora\main.LST
 
ROM used: 58 (6%)
Largest free fragment is 966
RAM used: 2 (3%) at main() level
3 (4%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 019
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\mereni\zavora\main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 0F
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: RETLW 00
.................... #fuses XT,NOWDT
....................
....................
....................
....................
.................... void main()
.................... {
0019: CLRF 04
001A: MOVLW 1F
001B: ANDWF 03,F
.................... output_high(PIN_A3);
001C: BSF 03.5
001D: BCF 05.3
001E: BCF 03.5
001F: BSF 05.3
.................... Delay_ms(250);
0020: MOVLW FA
0021: MOVWF 0F
0022: CALL 004
.................... output_low(PIN_A3);
0023: BSF 03.5
0024: BCF 05.3
0025: BCF 03.5
0026: BCF 05.3
.................... Delay_ms(250);
0027: MOVLW FA
0028: MOVWF 0F
0029: CALL 004
....................
.................... while(true)
.................... {
.................... if(input(PIN_A4)) output_low(PIN_A3);
002A: BSF 03.5
002B: BSF 05.4
002C: BCF 03.5
002D: BTFSS 05.4
002E: GOTO 034
002F: BSF 03.5
0030: BCF 05.3
0031: BCF 03.5
0032: BCF 05.3
.................... else output_high(PIN_A3);
0033: GOTO 038
0034: BSF 03.5
0035: BCF 05.3
0036: BCF 03.5
0037: BSF 05.3
.................... }
0038: GOTO 02A
.................... }
....................
0039: SLEEP
/programy/C/PIC/mereni/zavora/main.PJT
0,0 → 1,32
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
/programy/C/PIC/mereni/zavora/main.SYM
0,0 → 1,13
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F delay_ms.P1
delay_us.P1
 
0004 delay_ms
0019 main
 
Project Files:
d:\@kaklik\programy\pic_c\mereni\zavora\main.c
D:\@Kaklik\programy\PIC_C\mereni\zavora\main.h
C:\PROGRAM FILES\PICC\devices\16F84.h
/programy/C/PIC/mereni/zavora/main.c
0,0 → 1,16
#include "D:\@Kaklik\programy\PIC_C\mereni\zavora\main.h"
 
 
void main()
{
output_high(PIN_A3);
Delay_ms(250);
output_low(PIN_A3);
Delay_ms(250);
while(true)
{
if(input(PIN_A4)) output_low(PIN_A3);
else output_high(PIN_A3);
}
}
/programy/C/PIC/mereni/zavora/main.cod
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
/programy/C/PIC/mereni/zavora/main.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/zavora/main.h
0,0 → 1,4
#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,NOWDT
 
/programy/C/PIC/mereni/zavora/main.sta
0,0 → 1,28
 
ROM used: 58 (6%)
966 (94%) including unused fragments
 
0 Average locations per line
6 Average locations per statement
 
RAM used: 2 (3%) at main() level
3 (4%) worst case
 
Lines Stmts % Files
----- ----- --- -----
17 9 100 d:\@kaklik\programy\pic_c\mereni\zavora\main.c
5 0 0 D:\@Kaklik\programy\PIC_C\mereni\zavora\main.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h
----- -----
266 18 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 36 1 delay_ms
0 33 57 0 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 54 966
 
/programy/C/PIC/mereni/zavora/main.tre
0,0 → 1,5
ÀÄmain
ÀÄmain 0/33 Ram=0
ÃÄ??0??
ÃÄdelay_ms 0/21 Ram=1
ÀÄdelay_ms 0/21 Ram=1
/programy/C/PIC/mereni/zavora/prg.bat
0,0 → 1,8
:start
call picpgr stop
call picpgr erase pic16f84
call picpgr program main.hex hex pic16f84
call picpgr run
pause
call picpgr stop
rem goto start
/programy/C/PIC/mereni/zavora/run.bat
0,0 → 1,5
call picpgr run
pause
call picpgr stop
pause
run.bat
/programy/C/PIC/mereni/zavora/vssver.scc
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
/programy/C/PIC/test/C16F873/blik/main.c
0,0 → 1,31
#include ".\main.h"
 
 
void main()
{
int8 ble;
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
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);
 
output_low(PIN_C1);
 
While(true)
{
output_c(ble++);
delay_ms(100);
 
Output_high(PIN_B2);
Delay_ms(100);
Output_low(PIN_B2);
Delay_ms(100);
 
}
 
}
/programy/C/PIC/test/C16F873/blik/main.h
0,0 → 1,15
#include <16F876A.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //Crystal osc <= 4mhz
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
 
#use delay(clock=20000000)
 
/programy/C/PIC/test/C16F873/blik/main.hex
0,0 → 1,17
:1000000000308A00192800002230840000080319FB
:1000100016280630F800F701F70B0C28F80B0B2810
:100020007B30F700F70B1228800B09288A110A127F
:100030006E2884011F30830583161F149F141F151B
:100040009F1107309C00FF308312A00083161F14FD
:100050009F141F159F1183121F109412A0122008C5
:1000600083168700831220162008831687008312C8
:10007000A011200883168700003083129400831695
:1000800094000108C73908388100831290010030BC
:10009000F800920000308316920007309C0005089B
:1000A0001030F700F70B522800001C0883120D13C4
:1000B00083169D018312A0102008831687008312E7
:1000C00087102108A10AA2000030A0008316870132
:1000D0008312220887006430A2000428612863008C
:02400E003A3F37
:00000001FF
;PIC16F876A
/programy/C/PIC/test/C16F876A/blik/blik.PJT
0,0 → 1,38
[PROJECT]
Target=blik.HEX
Development_Mode=
Processor=0x876A
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[blik.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=blik.c
 
[Windows]
0=0000 blik.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.c
2=
[Units]
Count=1
1=D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.c (main)
/programy/C/PIC/test/C16F876A/blik/blik.cof
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
/programy/C/PIC/test/C16F876A/blik/blik.lst
0,0 → 1,175
CCS PCM C Compiler, Version 3.245, 27853 29-VI-08 23:25
 
Filename: D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.lst
 
ROM used: 114 words (1%)
Largest free fragment is 2048
RAM used: 7 (4%) at main() level
8 (5%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 017
0003: NOP
.................... #include ".\blik.h"
.................... #include <16F876A.h>
.................... //////// Standard Header file for the PIC16F876A device ////////////////
.................... #device PIC16F876A
.................... #list
....................
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES HS //High speed Osc (> 4mhz)
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
....................
.................... #use delay(clock=20000000)
0004: MOVLW 22
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 016
0009: MOVLW 06
000A: MOVWF 78
000B: CLRF 77
000C: DECFSZ 77,F
000D: GOTO 00C
000E: DECFSZ 78,F
000F: GOTO 00B
0010: MOVLW 7B
0011: MOVWF 77
0012: DECFSZ 77,F
0013: GOTO 012
0014: DECFSZ 00,F
0015: GOTO 009
0016: RETLW 00
....................
....................
....................
....................
.................... void main()
.................... {
0017: CLRF 04
0018: MOVLW 1F
0019: ANDWF 03,F
001A: BSF 03.5
001B: BSF 1F.0
001C: BSF 1F.1
001D: BSF 1F.2
001E: BCF 1F.3
001F: MOVLW 07
0020: MOVWF 1C
....................
.................... setup_adc_ports(NO_ANALOGS);
*
0024: BSF 03.5
0025: BSF 1F.0
0026: BSF 1F.1
0027: BSF 1F.2
0028: BCF 1F.3
.................... setup_adc(ADC_OFF);
0029: BCF 03.5
002A: BCF 1F.0
.................... setup_spi(FALSE);
*
0021: MOVLW FF
0022: BCF 03.5
0023: MOVWF 20
*
002B: BCF 14.5
002C: BCF 20.5
002D: MOVF 20,W
002E: BSF 03.5
002F: MOVWF 07
0030: BCF 03.5
0031: BSF 20.4
0032: MOVF 20,W
0033: BSF 03.5
0034: MOVWF 07
0035: BCF 03.5
0036: BCF 20.3
0037: MOVF 20,W
0038: BSF 03.5
0039: MOVWF 07
003A: MOVLW 00
003B: BCF 03.5
003C: MOVWF 14
003D: BSF 03.5
003E: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
003F: MOVF 01,W
0040: ANDLW C7
0041: IORLW 08
0042: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
0043: BCF 03.5
0044: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0045: MOVLW 00
0046: MOVWF 78
0047: MOVWF 12
0048: MOVLW 00
0049: BSF 03.5
004A: MOVWF 12
.................... setup_comparator(NC_NC_NC_NC);
004B: MOVLW 07
004C: MOVWF 1C
004D: MOVF 05,W
004E: MOVLW 10
004F: MOVWF 77
0050: DECFSZ 77,F
0051: GOTO 050
0052: NOP
0053: MOVF 1C,W
0054: BCF 03.5
0055: BCF 0D.6
.................... setup_vref(FALSE);
0056: BSF 03.5
0057: CLRF 1D
....................
.................... While(true)
.................... {
.................... Delay_ms(500);
0058: MOVLW 02
0059: BCF 03.5
005A: MOVWF 21
005B: MOVLW FA
005C: MOVWF 22
005D: CALL 004
005E: DECFSZ 21,F
005F: GOTO 05B
.................... Output_high(PIN_B1);
0060: BSF 03.5
0061: BCF 06.1
0062: BCF 03.5
0063: BSF 06.1
.................... Delay_ms(500);
0064: MOVLW 02
0065: MOVWF 21
0066: MOVLW FA
0067: MOVWF 22
0068: CALL 004
0069: DECFSZ 21,F
006A: GOTO 066
.................... Output_low(PIN_B1);
006B: BSF 03.5
006C: BCF 06.1
006D: BCF 03.5
006E: BCF 06.1
.................... }
006F: BSF 03.5
0070: GOTO 058
....................
.................... }
0071: SLEEP
 
Configuration Fuses:
Word 1: 3F3A HS NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT
/programy/C/PIC/test/C16F876A/blik/blik.sta
0,0 → 1,31
 
ROM used: 114 (1%)
114 (1%) including unused fragments
 
0 Average locations per line
8 Average locations per statement
 
RAM used: 7 (4%) at main() level
8 (5%) worst case
 
Lines Stmts % Files
----- ----- --- -----
25 14 100 D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.c
16 0 0 D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.h
270 0 0 C:\Program Files\PICC\devices\16F876A.h
----- -----
622 28 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 19 17 1 @delay_ms1
0 91 80 1 main
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 110 1934
00800-00FFF 0 2048
01000-017FF 0 2048
01800-01FFF 0 2048
 
/programy/C/PIC/test/C16F876A/blik/blik.sym
0,0 → 1,45
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
01B CCP_2_LOW
01B-01C CCP_2
01C CCP_2_HIGH
020 @TRIS_C
021 main.@SCRATCH
022 @delay_ms1.P1
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
09C.6 C1OUT
09C.7 C2OUT
 
0004 @delay_ms1
0017 main
0017 @cinit
 
Project Files:
D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.c
D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.h
C:\Program Files\PICC\devices\16F876A.h
 
Units:
D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.c (main)
 
Compiler Settings:
Processor: PIC16F876A
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.err
INHX8: D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.hex
Symbols: D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.sym
List: D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.lst
Debug/COFF: D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.cof
Call Tree: D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.tre
Statistics: D:\KAKLIK\projekty\programy\C\PIC_C\test\C16F876A\blik\blik.sta
/programy/C/PIC/test/C16F876A/blik/blik.BAK
0,0 → 1,24
#include "D:\KAKLIK\projekty\programy\PIC_C\test\PIC16F876A\blik\blik.h"
 
 
void main()
{
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
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(true)
{
Delay_ms(500);
Output_high(PIN_B1);
Delay_ms(500);
Output_low(PIN_B1);
}
 
}
/programy/C/PIC/test/C16F876A/blik/blik.c
0,0 → 1,24
#include ".\blik.h"
 
 
void main()
{
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
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(true)
{
Delay_ms(500);
Output_high(PIN_B1);
Delay_ms(500);
Output_low(PIN_B1);
}
 
}
/programy/C/PIC/test/C16F876A/blik/blik.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/test/C16F876A/blik/blik.h
0,0 → 1,15
#include <16F876A.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
 
#use delay(clock=20000000)
 
/programy/C/PIC/test/C16F876A/blik/blik.hex
0,0 → 1,18
:1000000000308A00172800002230840000080319FD
:1000100016280630F800F701F70B0C28F80B0B2810
:100020007B30F700F70B1228800B0928003484017D
:100030001F30830583161F149F141F159F1107304F
:100040009C00FF308312A00083161F149F141F15FD
:100050009F1183121F109412A0122008831687008C
:10006000831220162008831687008312A01120080F
:1000700083168700003083129400831694000108D1
:10008000C73908388100831290010030F8009200CF
:1000900000308316920007309C0005081030F700EE
:1000A000F70B502800001C0883120D1383169D01C6
:1000B00002308312A100FA30A2000420A10B5B28B9
:1000C00083168610831286140230A100FA30A20033
:1000D0000420A10B662883168610831286108316CF
:0400E0005828630039
:02400E003A3F37
:00000001FF
;PIC16F876A
/programy/C/PIC/test/C16F876A/blik/blik.tre
0,0 → 1,5
ÀÄblik
ÀÄmain 0/91 Ram=1
ÃÄ??0??
ÃÄ@delay_ms1 0/19 Ram=1
ÀÄ@delay_ms1 0/19 Ram=1
/programy/C/PIC/test/C16F876A/LCD/LCD.C
0,0 → 1,311
// LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
// (c)miho 2002,2005
//
// Historie:
//
// 0.00 Uvodni verze se snadnou definici portu LCD displeje
// 0.01 Oprava portu (zapomenute stare identifikatory)
// 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
// 0.03 Doplnena procedura lcd_clr pro smazani displeje
//
//
// Funkce:
//
// lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
//
// lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
// \f = \x0C - nova stranka - smazani displeje
// \n = \x0A - odradkovani (prechod na druhou radku)
// \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
// \r = \x0D - goto home to position 1,1
// \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
// \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
// Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
//
// lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
// nekontroluje parametry
//
// lcd_cursor_on zapne kurzor
// lcd_cursor_off vypne kurzor
//
// lcd_clr smaze displej
//
// lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
// retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
// Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
// Na konci se provede lcd_gotoxy(1,1).
// Na konci teto knihovny je priklad pouziti definovanych znaku
//
//
// Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
//
// #define LCD_RS PIN_B2 // rizeni registru LCD displeje
// #define LCD_E PIN_B1 // enable LCD displeje
// #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
//
//
// Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
//
// #define LCD_RS PIN_B2 // rizeni registru LCD displeje
// #define LCD_E PIN_B1 // enable LCD displeje
// #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
// #define LCD_D1 PIN_C3 // D1
// #define LCD_D2 PIN_C4 // D2
// #define LCD_D3 PIN_C5 // D3
 
 
 
 
// Privatni sekce, cist jen v pripade, ze neco nefunguje
 
 
 
 
#ifdef LCD_DATA_LSB
// Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
// bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
// v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
//
#define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
#define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
#define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
#define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
//
#if LCD_SHIFT>4 // kontrola mezi
#error LCD data port LSB bit not in range 0..4
#endif
#endif
 
 
// Definice konstant pro LCD display
//
#define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
#define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
#define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
 
 
// Definice rezimu LCD displeje
//
BYTE const LCD_INIT_STRING[4] =
{
0x28, // intrfejs 4 bity, 2 radky, font 5x7
LCD_CURSOR_OFF_, // display on, kurzor off,
0x01, // clear displeje
0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
};
 
 
// Odesle nibble do displeje (posle data a klikne signalem e)
//
void lcd_send_nibble( BYTE n )
{
#ifdef LCD_DATA_LSB
// data jsou za sebou na 4 bitech jednoho portu
*LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
#else
// data jsou na libovolnych 4 bitech libovolnych portu
output_bit(LCD_D0,bit_test(n,0));
output_bit(LCD_D1,bit_test(n,1));
output_bit(LCD_D2,bit_test(n,2));
output_bit(LCD_D3,bit_test(n,3));
#endif
output_bit(LCD_E,1); // vzestupna hrana
delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
}
 
 
// Odesle bajt do registru LCD
//
// Pokud je Adr=0 .. instrukcni registr
// Pokud je Adr=1 .. datovy registr
//
void lcd_send_byte( BOOLEAN Adr, BYTE n )
{
output_bit(LCD_RS,Adr); // vyber registr
swap(n);
lcd_send_nibble(n); // posli horni pulku bajtu
swap(n);
lcd_send_nibble(n); // posli spodni pulku bajtu
delay_us(40); // minimalni doba na provedeni prikazu
}
 
 
// Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
//
// Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
//
void lcd_init()
{
 
int i; // pocitadlo cyklu
 
delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
 
#ifdef LCD_DATA_LSB
// data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
*LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
#endif
 
output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
 
for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
{
delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
lcd_send_nibble(3); // rezim 8 bitu
}
 
delay_us(40); // cas na zpracovani
lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
delay_us(40); // cas na zpracovani
 
for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
delay_ms(2);
}
}
 
 
// Proved presun kurzoru
//
// Pozice 1.1 je domu
//
void lcd_gotoxy( BYTE x, BYTE y)
{
 
BYTE Adr;
 
Adr=x-1;
if(y==2)
Adr+=LCD_LINE_2;
 
lcd_send_byte(0,0x80|Adr);
}
 
 
// Zapis znaku na displej, zpracovani ridicich znaku
//
void lcd_putc( char c)
{
 
switch (c)
{
case '\f' : lcd_send_byte(0,1); // smaz displej
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
case '\r' : lcd_gotoxy(1,1); break; // presun home
case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
lcd_send_byte(1,c); break; // zapis znak
}
}
 
 
// Zapni kurzor
//
void lcd_cursor_on()
{
lcd_send_byte(0,LCD_CURSOR_ON_);
}
 
 
// Vypni kurzor
//
void lcd_cursor_off()
{
lcd_send_byte(0,LCD_CURSOR_OFF_);
}
 
 
// Smaz displej
//
void lcd_clr()
{
lcd_putc('\f');
}
 
 
// Definice vlastnich fontu
//
// Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
// Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
// priklad pouziti definovanych znaku.
 
 
// Pomocna procedura pro posilani ridicich dat do radice displeje
//
void lcd_putc2(int Data)
{
lcd_send_byte(1,Data);
}
 
 
// Pomocne definice pro programovani obsahu CGRAM
//
#define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
#define lcd_define_def(String) printf(lcd_putc2,String);
#define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
 
 
// Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
//
#define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
 
 
// Pripravene definice fontu vybranych znaku
// V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
//
#define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
#define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
#define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
#define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
#define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
#define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
#define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
#define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
#define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
#define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
#define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
#define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
#define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
#define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
#define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
#define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
#define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
#define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
#define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
#define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
#define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
#define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
#define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
#define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
#define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
#define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
#define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
#define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
#define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
#define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
#define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
#define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
#define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
#define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
#define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
 
 
// Priklad pouziti definovanych znaku
//
//
//void lcd_sample()
//{
// lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
// lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
// // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
// // jediny definicni retezec)
// printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
// delay_ms(1000);
// lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
// delay_ms(1000);
//}
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/programy/C/PIC/test/C16F876A/LCD/main.BAK
0,0 → 1,31
#include "main.h"
 
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
 
#include "LCD.C"
 
void main()
{
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
 
lcd_init();
 
while(true);
{
Delay_ms(100);
 
LCD_gotoxy(1,1);
printf(lcd_putc,"Ahoj, Display funguje");
}
 
}
/programy/C/PIC/test/C16F876A/LCD/main.PJT
0,0 → 1,39
 
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x877F
ToolSuite=CCS
 
[Directories]
Library=
LinkerScript=
 
[Target Data]
FileList=C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.
 
[Windows]
0=0000 main. 0 0 796 451 3 0
 
[Opened Files]
1=C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.c
2=
 
[Units]
Count=1
1=C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.c (main)
/programy/C/PIC/test/C16F876A/LCD/main.c
0,0 → 1,34
#include "main.h"
 
 
#define LCD_RS PIN_C7 // rizeni registru LCD displeje <lcd.c>
#define LCD_E PIN_B7 // enable LCD displeje <lcd.c>
#define LCD_D0 PIN_B3 // data LCD <lcd.c>
#define LCD_D1 PIN_B2
#define LCD_D2 PIN_B1
#define LCD_D3 PIN_B0
 
#include "LCD.C"
 
void main()
{
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
 
lcd_init();
 
while(true);
{
Delay_ms(100);
 
LCD_gotoxy(1,1);
printf(lcd_putc,"Ahoj, Display funguje");
}
 
}
/programy/C/PIC/test/C16F876A/LCD/main.cof
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
/programy/C/PIC/test/C16F876A/LCD/main.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/test/C16F876A/LCD/main.h
0,0 → 1,15
#include <16F877.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
 
#use delay(clock=4000000)
 
/programy/C/PIC/test/C16F876A/LCD/main.hex
0,0 → 1,44
:1000000000308A00FC2800000A108A100A118207BA
:1000100028340C34013406340A108A100A1182077D
:10002000413468346F346A342C34203444346934B5
:10003000733470346C3461347934203466347534FC
:100040006E34673475346A34653400342330840088
:10005000000803193A280130F800F701F70B2E28A1
:10006000F80B2D284A30F700F70B34280000000069
:10007000800B2B28003429183F288611402886152C
:10008000831686118312A9184728061148280615D9
:1000900083160611831229194F28861050288614BA
:1000A000831686108312A91957280610582806149B
:1000B0008316061083128617831686130000831298
:1000C00086138316861383120034A708031D6A283B
:1000D00087136B288717A0132008831687008312C5
:1000E000A80E2808A9003B20A80E2808A9003B203C
:1000F0000D30F700F70B7A2800341430A3002620C7
:100100008713A01320088316870083128613831693
:1001100086138312A1012108023C031C9728023098
:10012000A30026200330A9003B20A10A8B280D3014
:10013000F700F70B99280230A9003B200D30F7009B
:10014000F70BA028A1012108023C031CB3282108B9
:100150000420A200A7012208A80065200230A30005
:100160002620A10AA3288A110A123329013023026A
:10017000A5002408023C031DBF284030A507250820
:100180008038A600A7012608A800652000342208B0
:100190000C3A0319D528063A0319DD28073A031942
:1001A000E328053A0319E828ED28A7010130A80043
:1001B00065200230A3002620F9280130A300023078
:1001C000A400B620F9280130A300A400B620F92825
:1001D000A7011030A8006520F92822081F3C031C45
:1001E000F3280730A2050130A7002208A8006520E7
:1001F000F9288A110A12442984011F3083058316C5
:100200001F149F141F159F11FF308312A000831627
:100210001F149F141F159F1183121F10831609129C
:1002200083129412A01220088316870083122016CE
:100230002008831687008312A011200883168700E8
:10024000003083129400831694000108C7390838DF
:100250008100831290010030F80092000030831674
:10026000920083127D2833296430A30026200130B8
:10027000A300A400B620A10121080C200038031916
:0C0280004529A10AA200C7283C29630000
:02400E00393F38
:00000001FF
;PIC16F877
/programy/C/PIC/test/C16F876A/LCD/main.lst
0,0 → 1,675
CCS PCM C Compiler, Version 3.245, 27853 16-XII-07 14:06
 
Filename: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.lst
 
ROM used: 326 words (4%)
Largest free fragment is 2048
RAM used: 7 (4%) at main() level
15 (9%) worst case
Stack: 4 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 0FC
0003: NOP
.................... #include "main.h"
.................... #include <16F877.h>
.................... //////// Standard Header file for the PIC16F877 device ////////////////
.................... #device PIC16F877
.................... #list
....................
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES XT //Crystal osc <= 4mhz
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES NODEBUG //No Debug mode for ICD
....................
.................... #use delay(clock=4000000)
0026: MOVLW 23
0027: MOVWF 04
0028: MOVF 00,W
0029: BTFSC 03.2
002A: GOTO 03A
002B: MOVLW 01
002C: MOVWF 78
002D: CLRF 77
002E: DECFSZ 77,F
002F: GOTO 02E
0030: DECFSZ 78,F
0031: GOTO 02D
0032: MOVLW 4A
0033: MOVWF 77
0034: DECFSZ 77,F
0035: GOTO 034
0036: NOP
0037: NOP
0038: DECFSZ 00,F
0039: GOTO 02B
003A: RETLW 00
....................
....................
....................
....................
.................... #define LCD_RS PIN_C7 // rizeni registru LCD displeje <lcd.c>
.................... #define LCD_E PIN_B7 // enable LCD displeje <lcd.c>
.................... #define LCD_D0 PIN_B3 // data LCD <lcd.c>
.................... #define LCD_D1 PIN_B2
.................... #define LCD_D2 PIN_B1
.................... #define LCD_D3 PIN_B0
....................
.................... #include "LCD.C"
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
.................... // (c)miho 2002,2005
.................... //
.................... // Historie:
.................... //
.................... // 0.00 Uvodni verze se snadnou definici portu LCD displeje
.................... // 0.01 Oprava portu (zapomenute stare identifikatory)
.................... // 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
.................... // 0.03 Doplnena procedura lcd_clr pro smazani displeje
.................... //
.................... //
.................... // Funkce:
.................... //
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
.................... //
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
.................... // \f = \x0C - nova stranka - smazani displeje
.................... // \n = \x0A - odradkovani (prechod na druhou radku)
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
.................... // \r = \x0D - goto home to position 1,1
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
.................... //
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
.................... // nekontroluje parametry
.................... //
.................... // lcd_cursor_on zapne kurzor
.................... // lcd_cursor_off vypne kurzor
.................... //
.................... // lcd_clr smaze displej
.................... //
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
.................... // Na konci se provede lcd_gotoxy(1,1).
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku
.................... //
.................... //
.................... // Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... //
.................... //
.................... // Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
.................... // #define LCD_D1 PIN_C3 // D1
.................... // #define LCD_D2 PIN_C4 // D2
.................... // #define LCD_D3 PIN_C5 // D3
....................
....................
....................
....................
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje
....................
....................
....................
....................
.................... #ifdef LCD_DATA_LSB
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
.................... //
.................... #define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
.................... #define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
.................... #define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
.................... #define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
.................... //
.................... #if LCD_SHIFT>4 // kontrola mezi
.................... #error LCD data port LSB bit not in range 0..4
.................... #endif
.................... #endif
....................
....................
.................... // Definice konstant pro LCD display
.................... //
.................... #define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
.................... #define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
.................... #define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
....................
....................
.................... // Definice rezimu LCD displeje
.................... //
.................... BYTE const LCD_INIT_STRING[4] =
.................... {
.................... 0x28, // intrfejs 4 bity, 2 radky, font 5x7
.................... LCD_CURSOR_OFF_, // display on, kurzor off,
.................... 0x01, // clear displeje
.................... 0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
.................... };
....................
....................
.................... // Odesle nibble do displeje (posle data a klikne signalem e)
.................... //
.................... void lcd_send_nibble( BYTE n )
.................... {
.................... #ifdef LCD_DATA_LSB
.................... // data jsou za sebou na 4 bitech jednoho portu
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
.................... #else
.................... // data jsou na libovolnych 4 bitech libovolnych portu
.................... output_bit(LCD_D0,bit_test(n,0));
003B: BTFSC 29.0
003C: GOTO 03F
003D: BCF 06.3
003E: GOTO 040
003F: BSF 06.3
0040: BSF 03.5
0041: BCF 06.3
.................... output_bit(LCD_D1,bit_test(n,1));
0042: BCF 03.5
0043: BTFSC 29.1
0044: GOTO 047
0045: BCF 06.2
0046: GOTO 048
0047: BSF 06.2
0048: BSF 03.5
0049: BCF 06.2
.................... output_bit(LCD_D2,bit_test(n,2));
004A: BCF 03.5
004B: BTFSC 29.2
004C: GOTO 04F
004D: BCF 06.1
004E: GOTO 050
004F: BSF 06.1
0050: BSF 03.5
0051: BCF 06.1
.................... output_bit(LCD_D3,bit_test(n,3));
0052: BCF 03.5
0053: BTFSC 29.3
0054: GOTO 057
0055: BCF 06.0
0056: GOTO 058
0057: BSF 06.0
0058: BSF 03.5
0059: BCF 06.0
.................... #endif
.................... output_bit(LCD_E,1); // vzestupna hrana
005A: BCF 03.5
005B: BSF 06.7
005C: BSF 03.5
005D: BCF 06.7
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
005E: NOP
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
005F: BCF 03.5
0060: BCF 06.7
0061: BSF 03.5
0062: BCF 06.7
.................... }
0063: BCF 03.5
0064: RETLW 00
....................
....................
.................... // Odesle bajt do registru LCD
.................... //
.................... // Pokud je Adr=0 .. instrukcni registr
.................... // Pokud je Adr=1 .. datovy registr
.................... //
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n )
.................... {
.................... output_bit(LCD_RS,Adr); // vyber registr
0065: MOVF 27,F
0066: BTFSS 03.2
0067: GOTO 06A
0068: BCF 07.7
0069: GOTO 06B
006A: BSF 07.7
006B: BCF 20.7
006C: MOVF 20,W
006D: BSF 03.5
006E: MOVWF 07
*
0104: MOVLW FF
0105: BCF 03.5
0106: MOVWF 20
.................... swap(n);
*
006F: BCF 03.5
0070: SWAPF 28,F
.................... lcd_send_nibble(n); // posli horni pulku bajtu
0071: MOVF 28,W
0072: MOVWF 29
0073: CALL 03B
.................... swap(n);
0074: SWAPF 28,F
.................... lcd_send_nibble(n); // posli spodni pulku bajtu
0075: MOVF 28,W
0076: MOVWF 29
0077: CALL 03B
.................... delay_us(40); // minimalni doba na provedeni prikazu
0078: MOVLW 0D
0079: MOVWF 77
007A: DECFSZ 77,F
007B: GOTO 07A
.................... }
007C: RETLW 00
....................
....................
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
.................... //
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
.................... //
.................... void lcd_init()
.................... {
....................
.................... int i; // pocitadlo cyklu
....................
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
007D: MOVLW 14
007E: MOVWF 23
007F: CALL 026
....................
.................... #ifdef LCD_DATA_LSB
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
.................... #endif
....................
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
0080: BCF 07.7
0081: BCF 20.7
0082: MOVF 20,W
0083: BSF 03.5
0084: MOVWF 07
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
0085: BCF 03.5
0086: BCF 06.7
0087: BSF 03.5
0088: BCF 06.7
....................
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
0089: BCF 03.5
008A: CLRF 21
008B: MOVF 21,W
008C: SUBLW 02
008D: BTFSS 03.0
008E: GOTO 097
.................... {
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
008F: MOVLW 02
0090: MOVWF 23
0091: CALL 026
.................... lcd_send_nibble(3); // rezim 8 bitu
0092: MOVLW 03
0093: MOVWF 29
0094: CALL 03B
.................... }
0095: INCF 21,F
0096: GOTO 08B
....................
.................... delay_us(40); // cas na zpracovani
0097: MOVLW 0D
0098: MOVWF 77
0099: DECFSZ 77,F
009A: GOTO 099
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
009B: MOVLW 02
009C: MOVWF 29
009D: CALL 03B
.................... delay_us(40); // cas na zpracovani
009E: MOVLW 0D
009F: MOVWF 77
00A0: DECFSZ 77,F
00A1: GOTO 0A0
....................
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
00A2: CLRF 21
00A3: MOVF 21,W
00A4: SUBLW 02
00A5: BTFSS 03.0
00A6: GOTO 0B3
.................... {
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
00A7: MOVF 21,W
00A8: CALL 004
00A9: MOVWF 22
00AA: CLRF 27
00AB: MOVF 22,W
00AC: MOVWF 28
00AD: CALL 065
.................... delay_ms(2);
00AE: MOVLW 02
00AF: MOVWF 23
00B0: CALL 026
.................... }
00B1: INCF 21,F
00B2: GOTO 0A3
.................... }
00B3: BCF 0A.3
00B4: BCF 0A.4
00B5: GOTO 133 (RETURN)
....................
....................
.................... // Proved presun kurzoru
.................... //
.................... // Pozice 1.1 je domu
.................... //
.................... void lcd_gotoxy( BYTE x, BYTE y)
.................... {
....................
.................... BYTE Adr;
....................
.................... Adr=x-1;
00B6: MOVLW 01
00B7: SUBWF 23,W
00B8: MOVWF 25
.................... if(y==2)
00B9: MOVF 24,W
00BA: SUBLW 02
00BB: BTFSS 03.2
00BC: GOTO 0BF
.................... Adr+=LCD_LINE_2;
00BD: MOVLW 40
00BE: ADDWF 25,F
....................
.................... lcd_send_byte(0,0x80|Adr);
00BF: MOVF 25,W
00C0: IORLW 80
00C1: MOVWF 26
00C2: CLRF 27
00C3: MOVF 26,W
00C4: MOVWF 28
00C5: CALL 065
.................... }
00C6: RETLW 00
....................
....................
.................... // Zapis znaku na displej, zpracovani ridicich znaku
.................... //
.................... void lcd_putc( char c)
.................... {
....................
.................... switch (c)
.................... {
00C7: MOVF 22,W
00C8: XORLW 0C
00C9: BTFSC 03.2
00CA: GOTO 0D5
00CB: XORLW 06
00CC: BTFSC 03.2
00CD: GOTO 0DD
00CE: XORLW 07
00CF: BTFSC 03.2
00D0: GOTO 0E3
00D1: XORLW 05
00D2: BTFSC 03.2
00D3: GOTO 0E8
00D4: GOTO 0ED
.................... case '\f' : lcd_send_byte(0,1); // smaz displej
00D5: CLRF 27
00D6: MOVLW 01
00D7: MOVWF 28
00D8: CALL 065
.................... delay_ms(2);
00D9: MOVLW 02
00DA: MOVWF 23
00DB: CALL 026
.................... break;
00DC: GOTO 0F9
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
00DD: MOVLW 01
00DE: MOVWF 23
00DF: MOVLW 02
00E0: MOVWF 24
00E1: CALL 0B6
00E2: GOTO 0F9
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home
00E3: MOVLW 01
00E4: MOVWF 23
00E5: MOVWF 24
00E6: CALL 0B6
00E7: GOTO 0F9
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
00E8: CLRF 27
00E9: MOVLW 10
00EA: MOVWF 28
00EB: CALL 065
00EC: GOTO 0F9
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
00ED: MOVF 22,W
00EE: SUBLW 1F
00EF: BTFSS 03.0
00F0: GOTO 0F3
00F1: MOVLW 07
00F2: ANDWF 22,F
.................... lcd_send_byte(1,c); break; // zapis znak
00F3: MOVLW 01
00F4: MOVWF 27
00F5: MOVF 22,W
00F6: MOVWF 28
00F7: CALL 065
00F8: GOTO 0F9
.................... }
.................... }
00F9: BCF 0A.3
00FA: BCF 0A.4
00FB: GOTO 144 (RETURN)
....................
....................
.................... // Zapni kurzor
.................... //
.................... void lcd_cursor_on()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_ON_);
.................... }
....................
....................
.................... // Vypni kurzor
.................... //
.................... void lcd_cursor_off()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_OFF_);
.................... }
....................
....................
.................... // Smaz displej
.................... //
.................... void lcd_clr()
.................... {
.................... lcd_putc('\f');
.................... }
....................
....................
.................... // Definice vlastnich fontu
.................... //
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
.................... // priklad pouziti definovanych znaku.
....................
....................
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje
.................... //
.................... void lcd_putc2(int Data)
.................... {
.................... lcd_send_byte(1,Data);
.................... }
....................
....................
.................... // Pomocne definice pro programovani obsahu CGRAM
.................... //
.................... #define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
.................... #define lcd_define_def(String) printf(lcd_putc2,String);
.................... #define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
....................
....................
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
.................... //
.................... #define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
....................
....................
.................... // Pripravene definice fontu vybranych znaku
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
.................... //
.................... #define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
.................... #define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
.................... #define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
.................... #define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
.................... #define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
.................... #define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
.................... #define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
.................... #define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
.................... #define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
.................... #define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
.................... #define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
.................... #define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
.................... #define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
.................... #define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
.................... #define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
.................... #define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
.................... #define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
.................... #define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
.................... #define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
.................... #define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
.................... #define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
.................... #define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
.................... #define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
.................... #define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
.................... #define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
.................... #define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
.................... #define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
.................... #define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
.................... #define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
.................... #define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
.................... #define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
.................... #define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
.................... #define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
.................... #define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
.................... #define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
....................
....................
.................... // Priklad pouziti definovanych znaku
.................... //
.................... //
.................... //void lcd_sample()
.................... //{
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
.................... // // jediny definicni retezec)
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
.................... // delay_ms(1000);
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
.................... // delay_ms(1000);
.................... //}
....................
....................
.................... void main()
.................... {
00FC: CLRF 04
00FD: MOVLW 1F
00FE: ANDWF 03,F
00FF: BSF 03.5
0100: BSF 1F.0
0101: BSF 1F.1
0102: BSF 1F.2
0103: BCF 1F.3
....................
.................... setup_adc_ports(NO_ANALOGS);
*
0107: BSF 03.5
0108: BSF 1F.0
0109: BSF 1F.1
010A: BSF 1F.2
010B: BCF 1F.3
.................... setup_adc(ADC_OFF);
010C: BCF 03.5
010D: BCF 1F.0
.................... setup_psp(PSP_DISABLED);
010E: BSF 03.5
010F: BCF 09.4
.................... setup_spi(FALSE);
0110: BCF 03.5
0111: BCF 14.5
0112: BCF 20.5
0113: MOVF 20,W
0114: BSF 03.5
0115: MOVWF 07
0116: BCF 03.5
0117: BSF 20.4
0118: MOVF 20,W
0119: BSF 03.5
011A: MOVWF 07
011B: BCF 03.5
011C: BCF 20.3
011D: MOVF 20,W
011E: BSF 03.5
011F: MOVWF 07
0120: MOVLW 00
0121: BCF 03.5
0122: MOVWF 14
0123: BSF 03.5
0124: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
0125: MOVF 01,W
0126: ANDLW C7
0127: IORLW 08
0128: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
0129: BCF 03.5
012A: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
012B: MOVLW 00
012C: MOVWF 78
012D: MOVWF 12
012E: MOVLW 00
012F: BSF 03.5
0130: MOVWF 12
....................
.................... lcd_init();
0131: BCF 03.5
0132: GOTO 07D
....................
.................... while(true);
0133: GOTO 133
.................... {
.................... Delay_ms(100);
0134: MOVLW 64
0135: MOVWF 23
0136: CALL 026
....................
.................... LCD_gotoxy(1,1);
0137: MOVLW 01
0138: MOVWF 23
0139: MOVWF 24
013A: CALL 0B6
.................... printf(lcd_putc,"Ahoj, Display funguje");
013B: CLRF 21
013C: MOVF 21,W
013D: CALL 00C
013E: IORLW 00
013F: BTFSC 03.2
0140: GOTO 145
0141: INCF 21,F
0142: MOVWF 22
0143: GOTO 0C7
0144: GOTO 13C
.................... }
....................
.................... }
0145: SLEEP
 
Configuration Fuses:
Word 1: 3F39 XT NOWDT NOPUT NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG
/programy/C/PIC/test/C16F876A/LCD/main.sta
0,0 → 1,39
 
ROM used: 326 (4%)
326 (4%) including unused fragments
 
1 Average locations per line
5 Average locations per statement
 
RAM used: 7 (4%) at main() level
15 (9%) worst case
 
Lines Stmts % Files
----- ----- --- -----
35 14 22 C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.c
16 0 0 C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.h
280 0 0 Z:\home\kaklik\%SystemDrive%\Program Files\PICC\devices\16F877.h
312 49 64 C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\LCD.C
----- -----
1286 126 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 6 1 @delay_ms1
0 8 2 0 @const36
0 42 13 1 lcd_send_nibble
0 24 7 2 lcd_send_byte
0 57 17 2 lcd_init
0 17 5 4 lcd_gotoxy
0 53 16 1 lcd_putc
0 74 23 1 main
0 26 8 0 @const10117
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 322 1722
00800-00FFF 0 2048
01000-017FF 0 2048
01800-01FFF 0 2048
 
/programy/C/PIC/test/C16F876A/LCD/main.sym
0,0 → 1,62
008 PSP_DATA
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
01B CCP_2_LOW
01B-01C CCP_2
01C CCP_2_HIGH
020 @TRIS_C
021 lcd_init.i
021 main.@SCRATCH
022 lcd_putc.c
022 lcd_init.@SCRATCH
023 @delay_ms1.P1
023 lcd_gotoxy.x
024 lcd_gotoxy.y
025 lcd_gotoxy.Adr
026 lcd_gotoxy.@SCRATCH
027 lcd_send_byte.Adr
028 lcd_send_byte.n
029 lcd_send_nibble.n
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
 
0026 @delay_ms1
0004 @const36
003B lcd_send_nibble
0065 lcd_send_byte
007D lcd_init
00B6 lcd_gotoxy
00C7 lcd_putc
00FC main
000C @const10117
00FC @cinit
 
Project Files:
C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.c
C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.h
Z:\home\kaklik\%SystemDrive%\Program Files\PICC\devices\16F877.h
C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\LCD.C
 
Units:
C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.c (main)
 
Compiler Settings:
Processor: PIC16F877
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.err
INHX8: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.hex
Symbols: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.sym
List: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.lst
Debug/COFF: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.cof
Call Tree: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.tre
Statistics: C:\windows\profiles\kaklik\My Documents\projekty\programy\C\PIC_C\test\C16F876A\LCD\main.sta
/programy/C/PIC/test/C16F876A/LCD/main.tre
0,0 → 1,38
ÀÄmain
ÀÄmain 0/74 Ram=1
ÃÄ??0??
ÃÄlcd_init 0/57 Ram=2
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_send_nibble 0/42 Ram=1
³ ÃÄlcd_send_nibble 0/42 Ram=1
³ ÃÄ@const36 0/8 Ram=0
³ ÃÄlcd_send_byte 0/24 Ram=2
³ ³ ÃÄlcd_send_nibble 0/42 Ram=1
³ ³ ÀÄlcd_send_nibble 0/42 Ram=1
³ ÀÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/24 Ram=2
³ ÃÄlcd_send_nibble 0/42 Ram=1
³ ÀÄlcd_send_nibble 0/42 Ram=1
ÃÄ@const10117 0/26 Ram=0
ÀÄlcd_putc 0/53 Ram=1
ÃÄlcd_send_byte 0/24 Ram=2
³ ÃÄlcd_send_nibble 0/42 Ram=1
³ ÀÄlcd_send_nibble 0/42 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/24 Ram=2
³ ÃÄlcd_send_nibble 0/42 Ram=1
³ ÀÄlcd_send_nibble 0/42 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/24 Ram=2
³ ÃÄlcd_send_nibble 0/42 Ram=1
³ ÀÄlcd_send_nibble 0/42 Ram=1
ÃÄlcd_send_byte 0/24 Ram=2
³ ÃÄlcd_send_nibble 0/42 Ram=1
³ ÀÄlcd_send_nibble 0/42 Ram=1
ÀÄlcd_send_byte 0/24 Ram=2
ÃÄlcd_send_nibble 0/42 Ram=1
ÀÄlcd_send_nibble 0/42 Ram=1
/programy/C/PIC/test/PIC16F88/blik/blik.BAK
0,0 → 1,44
#include "blik.h"
 
 
void main()
{
 
int i;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD); // parametry
setup_adc(ADC_OFF);
setup_spi(FALSE);
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);
setup_oscillator(False);
 
while(true) // nekonecny cyklus
{
output_high(PIN_A4); // nastav B0 na 1
Delay_ms(50); // pockej 50ms
output_high(PIN_B1); // nastav B0 na 1
Delay_ms(50); // pockej 50ms
output_high(PIN_B2); // nastav B0 na 1
 
for(i=0;i<=100;i++)
{
 
Output_high(PIN_A2);
Delay_ms(1);
Output_low(PIN_A2);
Delay_ms(1);
}
 
output_low(PIN_A4); //nastav B0 na 0
Delay_ms(50); // pockej 50ms
output_low(PIN_B1); //nastav B0 na 0
Delay_ms(50); // pockej 50ms
output_low(PIN_B2); //nastav B0 na 0
Delay_ms(50); // pockej 50ms
} // opakuj cyklus
 
}
/programy/C/PIC/test/PIC16F88/blik/blik.cof
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
/programy/C/PIC/test/PIC16F88/blik/blik.lst
0,0 → 1,218
CCS PCM C Compiler, Version 3.245, 27853 24-III-08 00:27
 
Filename: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.lst
 
ROM used: 136 words (3%)
Largest free fragment is 2048
RAM used: 6 (3%) at main() level
6 (3%) worst case
Stack: 0 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 004
0003: NOP
.................... #include "blik.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES INTRC //Crystal osc <= 4mhz
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES NOMCLR //Master Clear pin used for I/O
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOFCMEN //Fail-safe clock monitor disabled
.................... #FUSES NOIESO //Internal External Switch Over mode disabled
....................
.................... #use delay(clock=37526)
....................
....................
....................
....................
.................... void main()
.................... {
0004: CLRF 04
0005: MOVLW 1F
0006: ANDWF 03,F
0007: BSF 03.5
0008: BCF 1F.4
0009: BCF 1F.5
000A: MOVF 1B,W
000B: ANDLW 80
000C: MOVWF 1B
000D: MOVLW 07
000E: MOVWF 1C
....................
.................... int i;
....................
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); // parametry
000F: BCF 1F.4
0010: BCF 1F.5
0011: MOVF 1B,W
0012: ANDLW 80
0013: MOVWF 1B
.................... setup_adc(ADC_OFF);
0014: BCF 03.5
0015: BCF 1F.0
.................... setup_spi(FALSE);
0016: BCF 14.5
0017: BSF 03.5
0018: BCF 06.2
0019: BSF 06.1
001A: BCF 06.4
001B: MOVLW 00
001C: BCF 03.5
001D: MOVWF 14
001E: BSF 03.5
001F: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
0020: MOVF 01,W
0021: ANDLW C7
0022: IORLW 08
0023: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
0024: BCF 03.5
0025: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0026: MOVLW 00
0027: MOVWF 78
0028: MOVWF 12
0029: MOVLW 00
002A: BSF 03.5
002B: MOVWF 12
.................... setup_comparator(NC_NC_NC_NC);
002C: MOVLW 07
002D: MOVWF 1C
002E: MOVF 1C,W
002F: BCF 03.5
0030: BCF 0D.6
.................... setup_vref(FALSE);
0031: BSF 03.5
0032: CLRF 1D
.................... setup_oscillator(False);
0033: CLRF 0F
0034: MOVF 0F,W
....................
.................... while(true) // nekonecny cyklus
.................... {
.................... output_high(PIN_B0); // nastav B0 na 1
0035: BCF 06.0
0036: BCF 03.5
0037: BSF 06.0
.................... Delay_ms(50); // pockej 50ms
0038: MOVLW 99
0039: MOVWF 77
003A: DECFSZ 77,F
003B: GOTO 03A
003C: NOP
003D: NOP
.................... output_high(PIN_B1); // nastav B0 na 1
003E: BSF 03.5
003F: BCF 06.1
0040: BCF 03.5
0041: BSF 06.1
.................... Delay_ms(50); // pockej 50ms
0042: MOVLW 99
0043: MOVWF 77
0044: DECFSZ 77,F
0045: GOTO 044
0046: NOP
0047: NOP
.................... output_high(PIN_B2); // nastav B0 na 1
0048: BSF 03.5
0049: BCF 06.2
004A: BCF 03.5
004B: BSF 06.2
....................
.................... for(i=0;i<=100;i++)
004C: CLRF 21
004D: MOVF 21,W
004E: SUBLW 64
004F: BTFSS 03.0
0050: GOTO 067
.................... {
....................
.................... Output_high(PIN_A2);
0051: BSF 03.5
0052: BCF 05.2
0053: BCF 03.5
0054: BSF 05.2
.................... Delay_ms(1);
0055: MOVLW 02
0056: MOVWF 77
0057: DECFSZ 77,F
0058: GOTO 057
0059: NOP
005A: NOP
.................... Output_low(PIN_A2);
005B: BSF 03.5
005C: BCF 05.2
005D: BCF 03.5
005E: BCF 05.2
.................... Delay_ms(1);
005F: MOVLW 02
0060: MOVWF 77
0061: DECFSZ 77,F
0062: GOTO 061
0063: NOP
0064: NOP
.................... }
0065: INCF 21,F
0066: GOTO 04D
....................
.................... output_low(PIN_B0); //nastav B0 na 0
0067: BSF 03.5
0068: BCF 06.0
0069: BCF 03.5
006A: BCF 06.0
.................... Delay_ms(50); // pockej 50ms
006B: MOVLW 99
006C: MOVWF 77
006D: DECFSZ 77,F
006E: GOTO 06D
006F: NOP
0070: NOP
.................... output_low(PIN_B1); //nastav B0 na 0
0071: BSF 03.5
0072: BCF 06.1
0073: BCF 03.5
0074: BCF 06.1
.................... Delay_ms(50); // pockej 50ms
0075: MOVLW 99
0076: MOVWF 77
0077: DECFSZ 77,F
0078: GOTO 077
0079: NOP
007A: NOP
.................... output_low(PIN_B2); //nastav B0 na 0
007B: BSF 03.5
007C: BCF 06.2
007D: BCF 03.5
007E: BCF 06.2
.................... Delay_ms(50); // pockej 50ms
007F: MOVLW 99
0080: MOVWF 77
0081: DECFSZ 77,F
0082: GOTO 081
0083: NOP
0084: NOP
.................... } // opakuj cyklus
0085: BSF 03.5
0086: GOTO 035
....................
.................... }
0087: SLEEP
 
Configuration Fuses:
Word 1: 3F19 NOWDT NOPUT NOMCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC
Word 2: 3FFC NOFCMEN NOIESO
/programy/C/PIC/test/PIC16F88/blik/blik.PJT
0,0 → 1,42
[PROJECT]
Target=blik.HEX
Development_Mode=
Processor=0x688F
ToolSuite=CCS
Processor_Text=PIC16F88
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[blik.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=blik.c
 
[Windows]
0=0000 blik.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.c
2=D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.h
3=C:\Program Files\PICC\devices\16F88.h
4=
5=
[Units]
Count=1
1=D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.c (main)
/programy/C/PIC/test/PIC16F88/blik/blik.c
0,0 → 1,44
#include "blik.h"
 
 
void main()
{
 
int i;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD); // parametry
setup_adc(ADC_OFF);
setup_spi(FALSE);
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);
setup_oscillator(False);
 
while(true) // nekonecny cyklus
{
output_high(PIN_B0); // nastav B0 na 1
Delay_ms(50); // pockej 50ms
output_high(PIN_B1); // nastav B0 na 1
Delay_ms(50); // pockej 50ms
output_high(PIN_B2); // nastav B0 na 1
 
for(i=0;i<=100;i++)
{
Output_high(PIN_A2);
Delay_ms(1);
Output_low(PIN_A2);
Delay_ms(1);
}
 
output_low(PIN_B0); //nastav B0 na 0
Delay_ms(50); // pockej 50ms
output_low(PIN_B1); //nastav B0 na 0
Delay_ms(50); // pockej 50ms
output_low(PIN_B2); //nastav B0 na 0
Delay_ms(50); // pockej 50ms
} // opakuj cyklus
 
}
/programy/C/PIC/test/PIC16F88/blik/blik.sta
0,0 → 1,28
 
ROM used: 136 (3%)
136 (3%) including unused fragments
 
0 Average locations per line
5 Average locations per statement
 
RAM used: 6 (3%) at main() level
6 (3%) worst case
 
Lines Stmts % Files
----- ----- --- -----
45 28 100 D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.c
19 0 0 D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.h
279 0 0 C:\Program Files\PICC\devices\16F88.h
----- -----
686 56 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 132 97 1 main
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 132 1912
00800-00FFF 0 2048
 
/programy/C/PIC/test/PIC16F88/blik/blik.h
0,0 → 1,18
#include <16F88.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC //Crystal osc <= 4mhz
#FUSES NOPUT //No Power Up Timer
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode disabled
 
#use delay(clock=37526)
 
/programy/C/PIC/test/PIC16F88/blik/blik.hex
0,0 → 1,20
:1000000000308A000428000084011F308305831615
:100010001F129F121B0880399B0007309C001F1283
:100020009F121B0880399B0083121F1094128316A5
:100030000611861406120030831294008316940071
:100040000108C73908388100831290010030F80098
:10005000920000308316920007309C001C08831227
:100060000D1383169D018F010F08061083120614CD
:100070009930F700F70B3A2800000000831686102D
:10008000831286149930F700F70B44280000000013
:100090008316061183120615A1012108643C031C76
:1000A000672883160511831205150230F700F70B38
:1000B0005728000000008316051183120511023035
:1000C000F700F70B612800000000A10A4D288316F5
:1000D0000610831206109930F700F70B6D28000008
:1000E000000083168610831286109930F700F70BF4
:1000F000772800000000831606118312061199303C
:10010000F700F70B812800000000831635286300F4
:04400E00193FFC3F1B
:00000001FF
;PIC16F88
/programy/C/PIC/test/PIC16F88/blik/blik.sym
0,0 → 1,39
015 CCP_1_LOW
015-016 CCP_1
016 CCP_1_HIGH
021 main.i
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
09C.6 C1OUT
09C.7 C2OUT
 
0004 main
0004 @cinit
 
Project Files:
D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.c
D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.h
C:\Program Files\PICC\devices\16F88.h
 
Units:
D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.c (main)
 
Compiler Settings:
Processor: PIC16F88
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.err
INHX8: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.hex
Symbols: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.sym
List: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.lst
Debug/COFF: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.cof
Call Tree: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.tre
Statistics: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F88\blik\blik.sta
/programy/C/PIC/test/PIC16F88/blik/blik.tre
0,0 → 1,3
ÀÄblik
ÀÄmain 0/132 Ram=1
ÀÄ??0??
/programy/C/PIC/test/PIC16F88/blik/blik.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/test/PIC16F88/blik/prg.bat
0,0 → 1,6
call picpgr stop LPT2
call picpgr erase pic16f88 LPT2
call picpgr program blik.hex hex pic16f88 LPT2
call picpgr run LPT2
pause
call picpgr stop LPT2
/programy/C/PIC/test/PIC16F84/blik/blik.PJT
0,0 → 1,38
[PROJECT]
Target=blik.HEX
Development_Mode=
Processor=0x6F84
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[blik.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=blik.c
 
[Windows]
0=0000 blik.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.c
2=
[Units]
Count=1
1=D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.c (main)
/programy/C/PIC/test/PIC16F84/blik/blik.cof
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
/programy/C/PIC/test/PIC16F84/blik/blik.lst
0,0 → 1,98
CCS PCM C Compiler, Version 3.245, 27853 23-III-08 21:00
 
Filename: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.lst
 
ROM used: 53 words (5%)
Largest free fragment is 971
RAM used: 3 (4%) at main() level
4 (6%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 019
0003: NOP
.................... #include "blik.h"
.................... #include <16F84A.h>
.................... //////// Standard Header file for the PIC16F84A device ////////////////
.................... #device PIC16F84A
.................... #list
....................
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES XT //Crystal osc <= 4mhz
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES NOPROTECT //Code not protected from reading
....................
.................... #use delay(clock=4000000)
0004: MOVLW 10
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: RETLW 00
....................
....................
....................
....................
.................... void main()
.................... {
0019: CLRF 04
001A: MOVLW 1F
001B: ANDWF 03,F
....................
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
001C: BSF 03.5
001D: MOVF 01,W
001E: ANDLW C7
001F: IORLW 08
0020: MOVWF 01
....................
.................... while(true)
.................... {
.................... output_high(PIN_B0);
0021: BCF 06.0
0022: BCF 03.5
0023: BSF 06.0
.................... Delay_ms(700);
0024: MOVLW 04
0025: MOVWF 0F
0026: MOVLW AF
0027: MOVWF 10
0028: CALL 004
0029: DECFSZ 0F,F
002A: GOTO 026
.................... output_low(PIN_B0);
002B: BSF 03.5
002C: BCF 06.0
002D: BCF 03.5
002E: BCF 06.0
.................... Delay_ms(50);
002F: MOVLW 32
0030: MOVWF 10
0031: CALL 004
.................... }
0032: BSF 03.5
0033: GOTO 021
....................
.................... }
0034: SLEEP
 
Configuration Fuses:
Word 1: 3FF9 XT NOWDT NOPUT NOPROTECT
/programy/C/PIC/test/PIC16F84/blik/blik.sta
0,0 → 1,28
 
ROM used: 53 (5%)
53 (5%) including unused fragments
 
0 Average locations per line
8 Average locations per statement
 
RAM used: 3 (4%) at main() level
4 (6%) worst case
 
Lines Stmts % Files
----- ----- --- -----
18 7 100 D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.c
10 0 0 D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.h
113 0 0 C:\Program Files\PICC\devices\16F84A.h
----- -----
282 14 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 40 1 @delay_ms1
0 28 53 1 main
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-003FF 49 971
 
/programy/C/PIC/test/PIC16F84/blik/blik.sym
0,0 → 1,32
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F main.@SCRATCH
010 @delay_ms1.P1
 
0004 @delay_ms1
0019 main
0019 @cinit
 
Project Files:
D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.c
D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.h
C:\Program Files\PICC\devices\16F84A.h
 
Units:
D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.c (main)
 
Compiler Settings:
Processor: PIC16F84A
Pointer Size: 8
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.err
INHX8: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.hex
Symbols: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.sym
List: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.lst
Debug/COFF: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.cof
Call Tree: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.tre
Statistics: D:\KAKLIK\projekty\programy\C\PIC_C\test\PIC16F84\blik\blik.sta
/programy/C/PIC/test/PIC16F84/blik/blik.BAK
0,0 → 1,9
#include "blik.h"
 
 
void main()
{
 
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
 
}
/programy/C/PIC/test/PIC16F84/blik/blik.c
0,0 → 1,17
#include "blik.h"
 
 
void main()
{
 
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
 
while(true)
{
output_high(PIN_B0);
Delay_ms(700);
output_low(PIN_B0);
Delay_ms(50);
}
 
}
/programy/C/PIC/test/PIC16F84/blik/blik.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/test/PIC16F84/blik/blik.h
0,0 → 1,9
#include <16F84A.h>
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
 
#use delay(clock=4000000)
 
/programy/C/PIC/test/PIC16F84/blik/blik.hex
0,0 → 1,10
:1000000000308A001928000010308400000803190D
:10001000182801308D008C018C0B0C288D0B0B28BF
:100020004A308C008C0B122800000000800B09283D
:10003000003484011F30830583160108C73908384E
:10004000810006108312061404308F00AF30900038
:1000500004208F0B262883160610831206103230D8
:0A006000900004208316212863009D
:02400E00F93F78
:00000001FF
;PIC16F84A
/programy/C/PIC/test/PIC16F84/blik/blik.tre
0,0 → 1,5
ÀÄblik
ÀÄmain 0/28 Ram=1
ÃÄ??0??
ÃÄ@delay_ms1 0/21 Ram=1
ÀÄ@delay_ms1 0/21 Ram=1
/programy/C/PIC/test/PIC16F84/blik/prg.bat
0,0 → 1,6
call picpgr stop LPT2
call picpgr erase pic16f84a LPT2
call picpgr program blik.hex hex pic16f84a LPT2
call picpgr run LPT2
pause
call picpgr stop LPT2
/programy/C/PIC/PICcam/876/camerus.PJT
0,0 → 1,44
 
[PROJECT]
Target=camerus.HEX
Development_Mode=
Processor=0x876A
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\Dr
Library=
LinkerScript=
 
[Target Data]
FileList=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\SW\876\camerus.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[camerus.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=camerus.c
 
[Windows]
0=0000 camerus.c 0 0 796 451 3 0
 
[Opened Files]
1=z:\home\kaklik\projects\programy\PIC_C\PICcam\876\camerus.c
2=
3=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\SW\876\camerus.h
4=C:\Program Files\PICC\devices\16F876A.h
5=
6=
 
[Units]
Count=1
1=C:\dokumenty\svn\Kaklik\roboti\istrobot\camerus\SW\876\camerus.c (main)
/programy/C/PIC/PICcam/876/camerus.c
0,0 → 1,159
#include ".\camerus.h"
 
#USE FAST_IO (C) // Brana C je ve FAST_IO modu, aby slo rychle cteni z kamery
 
// kroutitka
#define CERVENA 3 // AN3/RA3
#define CERNA 2 // AN2/RA2
#define ZELENA 1 // AN1/RA0
#define MODRA 0 // AN0/RA1
 
// I/O
#define LED PIN_C0 // LED signalizujici start programu
#define HREF PIN_C5 // Signal HREF z kamery (v H po celou dobu radku)
#define PIX PIN_C6 // Vstup pro body z kamery (za trivstupim hradlem OR (dig. komparator))
#define SERVO PIN_B7 // Vystup na servo (1 az 2ms po cca 20ms (synchronizovano snimkovym kmitoctem))
#define MOT_L PIN_B5 // Smer otaceni leveho motoru; druhy pol je RC2
#define MOT_R PIN_B6 // Smer otaceni praveho motoru; druhy pol je RC1
 
void main()
{
int8 cas; // Cas hrany bila/cerna v radce
int8 offset; // Promena pro ulozeni ovsetu
int8 rr; // Promenna na ulozeni Rozumne rychlost
int8 r1; // Rychlost motoru 1
int8 r2; // Rychlost motoru 2
 
int16 ble; // Prodleva do rozjezdu
 
setup_adc_ports(ALL_ANALOG); // Zapnuti A/D prevodniku pro cteni kroutitek
setup_adc(ADC_CLOCK_INTERNAL);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); // Casovac pro mereni casu hrany W/B v radce
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DIV_BY_16,255,1); // Casovac PWM motoru
setup_ccp1(CCP_PWM); // RC1 // PWM pro motory
setup_ccp2(CCP_PWM); // RC2
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
 
set_tris_c(0b11111000); // Nastaveni vstup/vystup pro branu C, protoze se nedela automaticky
set_pwm1_duty(0); // Zastav motory
set_pwm2_duty(0);
output_low(MOT_L);
output_low(MOT_R);
 
output_high(LED); // Budeme blikat LED, aby se poznalo, ze byl RESET
 
delay_ms(200); // Musi se pockat, nez se rozjede kamera, nez se do ni zacnou posilat prikazy
 
//... Nastaveni kamery ...
i2c_start(); // Soft RESET kamery
i2c_write(0xC0); // Pro single slave musi mit vsechny zapisy adresu C0h
i2c_write(0x12); // Adresa registru COMH
i2c_write(0x80 | 0x24); // Zapis ridiciho slova
i2c_stop();
 
i2c_start(); // BW
i2c_write(0xC0);
i2c_write(0x28);
i2c_write(0b01000001);
i2c_stop();
 
 
i2c_start(); // Contrast
i2c_write(0xC0);
i2c_write(0x05);
i2c_write(0xA0);
i2c_stop();
/*
i2c_start(); // Brightness
i2c_write(0xC0);
i2c_write(0x06);
i2c_write(0x80);
i2c_stop();
 
i2c_start(); // Band Filter
i2c_write(0xC0);
i2c_write(0x2D);
i2c_write(0x04 | 0x03);
i2c_stop();
*/
i2c_start(); // VSTRT
i2c_write(0xC0);
i2c_write(0x19);
i2c_write(45);
i2c_stop();
 
i2c_start(); // VEND
i2c_write(0xC0);
i2c_write(0x1A);
i2c_write(45);
i2c_stop();
 
output_low(LED); // Blikani LED
delay_ms(200);
 
output_high(LED); // Blikani LED
delay_ms(200);
output_low(LED);
 
cas=128; // Inicializace promenych, aby neslo servo za roh a aby se to rozjelo jeste dneska
ble=0;
 
// ... Hlavni smycka ...
while(true)
{
while(!input(HREF)); // Cekej nez se zacnou posilat pixely z radky
set_timer0(0); // Vynuluj pocitadlo casu
while(input(HREF)) // Po dobu vysilani radky cekej na hranu W/B
{
if(!input(PIX)) // Pokud se dvakrat za sebou precetla CERNA
if(!input(PIX))
{
cas=get_timer0(); // Precti cas z citace casu hrany
cas=255-cas; // Vlevo je vpravo
break;
};
};
 
set_adc_channel(MODRA); // Kroutitko na vystredeni predniho kolecka
Delay_ms(1);
offset=read_adc();
output_high(SERVO); // Odvysilani impuzu 1 az 2ms pro servo
delay_us(1000);
delay_us(offset);
delay_us(offset);
delay_us(cas);
delay_us(cas);
output_low(SERVO);
 
ble++; // Casovac pro odlozeni rozjezdu po zapnuti napajeni
set_adc_channel(ZELENA); // Kroutitka pro vykon motoru (!!! to bude chtit jeste predelat !!!)
Delay_ms(1);
offset=read_adc();
set_adc_channel(CERNA);
Delay_ms(1);
rr=read_adc();
r1=cas>>1; // Elektronicky diferencial
r2=255-offset-(cas>>1);
 
if (ble==99) // Rozjezd na Rozumnou rychlost
{
set_pwm1_duty(rr);
set_pwm2_duty(rr);
};
if ((ble>100)&&(ble<60000)) // Jizda
{
if (r1<=rr) set_pwm1_duty(r1);
if (r2<=rr) set_pwm2_duty(r2);
}
else
{
set_pwm1_duty(0); // Zastaveni
set_pwm2_duty(0);
}
};
}
/programy/C/PIC/PICcam/876/camerus.h
0,0 → 1,16
#include <16F876A.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
 
#use delay(clock=20000000)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3,force_hw)
 
/programy/C/PIC/PICcam/873/camerus.BAK
0,0 → 1,62
#include ".\camerus.h"
 
#define CAMERA_ADR 0xC0
 
 
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
 
output_high(PIN_C0);
output_low(PIN_C6);
 
Delay_ms(200);
output_low(PIN_C0);
Delay_ms(200);
output_high(PIN_C0);
 
i2c_start(); // Reset
i2c_write(CAMERA_ADR);
i2c_write(0x12);
i2c_write(0x80 | 0x24);
i2c_stop();
 
// **** Write data => Adr($13) = 0x05 ****
// This will tri-state the Y and UV busses on the OV6620, which
// will allow re-programming of the atmega8 to proceed at startup
// if needed.
 
i2c_start();
i2c_write(CAMERA_ADR);
i2c_write(0x13);
i2c_write(0x05);
i2c_stop();
 
Delay_ms(250);
 
//**** Write data => Adr($3F) = 0x42 ****
// This will turn on the external clock for the atmega8 to use.
 
i2c_start();
i2c_write(CAMERA_ADR);
i2c_write(0x3F);
i2c_write(0x42);
i2c_stop();
 
// Wait for a short amount of time for the external clock
// to stabilize
 
Delay_ms(250);
 
 
output_low(PIN_C0);
 
// turn on the mega8 by releasing the reset line
output_high(PIN_C6);
 
while(true);
}
/programy/C/PIC/PICcam/873/camerus.c
0,0 → 1,62
#include ".\camerus.h"
 
#define CAMERA_ADR 0xC4
 
 
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
 
output_high(PIN_C0);
output_low(PIN_C6);
 
Delay_ms(200);
output_low(PIN_C0);
Delay_ms(200);
output_high(PIN_C0);
 
i2c_start(); // Reset
i2c_write(CAMERA_ADR);
i2c_write(0x12);
i2c_write(0x80 | 0x24);
i2c_stop();
 
// **** Write data => Adr($13) = 0x05 ****
// This will tri-state the Y and UV busses on the OV6620, which
// will allow re-programming of the atmega8 to proceed at startup
// if needed.
 
i2c_start();
i2c_write(CAMERA_ADR);
i2c_write(0x13);
i2c_write(0x05);
i2c_stop();
 
Delay_ms(250);
 
//**** Write data => Adr($3F) = 0x42 ****
// This will turn on the external clock for the atmega8 to use.
 
i2c_start();
i2c_write(CAMERA_ADR);
i2c_write(0x3F);
i2c_write(0x42);
i2c_stop();
 
// Wait for a short amount of time for the external clock
// to stabilize
 
Delay_ms(250);
 
 
output_low(PIN_C0);
 
// turn on the mega8 by releasing the reset line
output_high(PIN_C6);
 
while(true);
}
/programy/C/PIC/PICcam/873/camerus.cof
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
/programy/C/PIC/PICcam/873/camerus.hex
0,0 → 1,28
:1000000000308A00292800002630840000080319E7
:1000100018280130A100A001A00B0C28A10B0B286F
:100020004A30A000A00B122800000000800B092815
:10003000003494138C11260893000230941B272857
:100040008C1D202800308316111B01308312A10063
:10005000003484011F308305A51525088316870009
:100060008312251625088316870001309300283057
:10007000831294008316941314131F149F141F15D6
:100080009F11FF308312A50083161F149F141F15A4
:100090009F1183121F1083160108C7390838810089
:1000A000831290010030A10092000030831692006C
:1000B0008312251025088316870083120714251341
:1000C00025088316870083120713C830A600042072
:1000D000251025088316870083120710C830A60054
:1000E0000420251025088316870083120714831621
:1000F000111411187928C4308312A6001920123067
:10010000A6001920A430A600192083161115111974
:100110008728111411188A28C4308312A6001920C8
:100120001330A60019200530A600192083161115DA
:1001300011199828FA308312A6000420831611148E
:100140001118A028C4308312A60019203F30A60041
:1001500019204230A6001920831611151119AE2856
:10016000FA308312A6000420251025088316870084
:10017000831207102513250883168700831207179B
:04018000C028630030
:02400E00393F38
:00000001FF
;PIC16F873
/programy/C/PIC/PICcam/873/camerus.lst
0,0 → 1,294
CCS PCM C Compiler, Version 3.245, 27853 22-IV-07 16:12
 
Filename: D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.lst
 
ROM used: 194 words (5%)
Largest free fragment is 2048
RAM used: 6 (3%) at main() level
7 (4%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 029
0003: NOP
.................... #include ".\camerus.h"
.................... #include <16F873.h>
.................... //////// Standard Header file for the PIC16F873 device ////////////////
.................... #device PIC16F873
.................... #list
....................
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES XT //Crystal osc <= 4mhz
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES NODEBUG //No Debug mode for ICD
....................
.................... #use delay(clock=4000000)
0004: MOVLW 26
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 21
000B: CLRF 20
000C: DECFSZ 20,F
000D: GOTO 00C
000E: DECFSZ 21,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 20
0012: DECFSZ 20,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: RETLW 00
.................... #use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3,force_HW)
0019: BCF 14.7
001A: BCF 0C.3
001B: MOVF 26,W
001C: MOVWF 13
001D: MOVLW 02
001E: BTFSC 14.7
001F: GOTO 027
0020: BTFSS 0C.3
0021: GOTO 020
0022: MOVLW 00
0023: BSF 03.5
0024: BTFSC 11.6
0025: MOVLW 01
0026: BCF 03.5
0027: MOVWF 21
0028: RETLW 00
*
0041: MOVLW FF
0042: BCF 03.5
0043: MOVWF 25
....................
....................
....................
.................... #define CAMERA_ADR 0xC4
....................
....................
.................... void main()
.................... {
*
0029: CLRF 04
002A: MOVLW 1F
002B: ANDWF 03,F
002C: BSF 25.3
002D: MOVF 25,W
002E: BSF 03.5
002F: MOVWF 07
0030: BCF 03.5
0031: BSF 25.4
0032: MOVF 25,W
0033: BSF 03.5
0034: MOVWF 07
0035: MOVLW 01
0036: MOVWF 13
0037: MOVLW 28
0038: BCF 03.5
0039: MOVWF 14
003A: BSF 03.5
003B: BCF 14.7
003C: BCF 14.6
003D: BSF 1F.0
003E: BSF 1F.1
003F: BSF 1F.2
0040: BCF 1F.3
.................... setup_adc_ports(NO_ANALOGS);
*
0044: BSF 03.5
0045: BSF 1F.0
0046: BSF 1F.1
0047: BSF 1F.2
0048: BCF 1F.3
.................... setup_adc(ADC_OFF);
0049: BCF 03.5
004A: BCF 1F.0
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
004B: BSF 03.5
004C: MOVF 01,W
004D: ANDLW C7
004E: IORLW 08
004F: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
0050: BCF 03.5
0051: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0052: MOVLW 00
0053: MOVWF 21
0054: MOVWF 12
0055: MOVLW 00
0056: BSF 03.5
0057: MOVWF 12
....................
.................... output_high(PIN_C0);
0058: BCF 03.5
0059: BCF 25.0
005A: MOVF 25,W
005B: BSF 03.5
005C: MOVWF 07
005D: BCF 03.5
005E: BSF 07.0
.................... output_low(PIN_C6);
005F: BCF 25.6
0060: MOVF 25,W
0061: BSF 03.5
0062: MOVWF 07
0063: BCF 03.5
0064: BCF 07.6
....................
.................... Delay_ms(200);
0065: MOVLW C8
0066: MOVWF 26
0067: CALL 004
.................... output_low(PIN_C0);
0068: BCF 25.0
0069: MOVF 25,W
006A: BSF 03.5
006B: MOVWF 07
006C: BCF 03.5
006D: BCF 07.0
.................... Delay_ms(200);
006E: MOVLW C8
006F: MOVWF 26
0070: CALL 004
.................... output_high(PIN_C0);
0071: BCF 25.0
0072: MOVF 25,W
0073: BSF 03.5
0074: MOVWF 07
0075: BCF 03.5
0076: BSF 07.0
....................
.................... i2c_start(); // Reset
0077: BSF 03.5
0078: BSF 11.0
0079: BTFSC 11.0
007A: GOTO 079
.................... i2c_write(CAMERA_ADR);
007B: MOVLW C4
007C: BCF 03.5
007D: MOVWF 26
007E: CALL 019
.................... i2c_write(0x12);
007F: MOVLW 12
0080: MOVWF 26
0081: CALL 019
.................... i2c_write(0x80 | 0x24);
0082: MOVLW A4
0083: MOVWF 26
0084: CALL 019
.................... i2c_stop();
0085: BSF 03.5
0086: BSF 11.2
0087: BTFSC 11.2
0088: GOTO 087
....................
.................... // **** Write data => Adr($13) = 0x05 ****
.................... // This will tri-state the Y and UV busses on the OV6620, which
.................... // will allow re-programming of the atmega8 to proceed at startup
.................... // if needed.
....................
.................... i2c_start();
0089: BSF 11.0
008A: BTFSC 11.0
008B: GOTO 08A
.................... i2c_write(CAMERA_ADR);
008C: MOVLW C4
008D: BCF 03.5
008E: MOVWF 26
008F: CALL 019
.................... i2c_write(0x13);
0090: MOVLW 13
0091: MOVWF 26
0092: CALL 019
.................... i2c_write(0x05);
0093: MOVLW 05
0094: MOVWF 26
0095: CALL 019
.................... i2c_stop();
0096: BSF 03.5
0097: BSF 11.2
0098: BTFSC 11.2
0099: GOTO 098
....................
.................... Delay_ms(250);
009A: MOVLW FA
009B: BCF 03.5
009C: MOVWF 26
009D: CALL 004
....................
.................... //**** Write data => Adr($3F) = 0x42 ****
.................... // This will turn on the external clock for the atmega8 to use.
....................
.................... i2c_start();
009E: BSF 03.5
009F: BSF 11.0
00A0: BTFSC 11.0
00A1: GOTO 0A0
.................... i2c_write(CAMERA_ADR);
00A2: MOVLW C4
00A3: BCF 03.5
00A4: MOVWF 26
00A5: CALL 019
.................... i2c_write(0x3F);
00A6: MOVLW 3F
00A7: MOVWF 26
00A8: CALL 019
.................... i2c_write(0x42);
00A9: MOVLW 42
00AA: MOVWF 26
00AB: CALL 019
.................... i2c_stop();
00AC: BSF 03.5
00AD: BSF 11.2
00AE: BTFSC 11.2
00AF: GOTO 0AE
....................
.................... // Wait for a short amount of time for the external clock
.................... // to stabilize
....................
.................... Delay_ms(250);
00B0: MOVLW FA
00B1: BCF 03.5
00B2: MOVWF 26
00B3: CALL 004
....................
....................
.................... output_low(PIN_C0);
00B4: BCF 25.0
00B5: MOVF 25,W
00B6: BSF 03.5
00B7: MOVWF 07
00B8: BCF 03.5
00B9: BCF 07.0
....................
.................... // turn on the mega8 by releasing the reset line
.................... output_high(PIN_C6);
00BA: BCF 25.6
00BB: MOVF 25,W
00BC: BSF 03.5
00BD: MOVWF 07
00BE: BCF 03.5
00BF: BSF 07.6
....................
.................... while(true);
00C0: GOTO 0C0
.................... }
00C1: SLEEP
 
Configuration Fuses:
Word 1: 3F39 XT NOWDT NOPUT NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG
/programy/C/PIC/PICcam/873/camerus.sta
0,0 → 1,30
 
ROM used: 194 (5%)
194 (5%) including unused fragments
 
1 Average locations per line
6 Average locations per statement
 
RAM used: 6 (3%) at main() level
7 (4%) worst case
 
Lines Stmts % Files
----- ----- --- -----
63 32 100 D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.c
17 0 0 D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.h
244 0 0 C:\Program Files\PICC\devices\16F873.h
----- -----
648 64 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 11 1 @delay_ms1
0 16 8 1 @I2C_WRITEU_1_59_60_4000000
0 153 79 0 main
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 190 1854
00800-00FFF 0 2048
 
/programy/C/PIC/PICcam/873/camerus.PJT
0,0 → 1,40
[PROJECT]
Target=camerus.HEX
Development_Mode=
Processor=0x873F
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\Dr
Library=
LinkerScript=
 
[Target Data]
FileList=D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.c
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[camerus.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=camerus.c
 
[Windows]
0=0000 camerus.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.c
2=
3=C:\Program Files\PICC\devices\16F873.h
4=
[Units]
Count=1
1=D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.c (main)
/programy/C/PIC/PICcam/873/camerus.err
0,0 → 1,2
No Errors
0 Errors, 0 Warnings.
/programy/C/PIC/PICcam/873/camerus.h
0,0 → 1,16
#include <16F873.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
 
#use delay(clock=4000000)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3,force_HW)
 
/programy/C/PIC/PICcam/873/camerus.sym
0,0 → 1,44
015 CCP_1_LOW
015-016 CCP_1
016 CCP_1_HIGH
01B CCP_2_LOW
01B-01C CCP_2
01C CCP_2_HIGH
020 @SCRATCH
021 @SCRATCH
021 _RETURN_
022 @SCRATCH
023 @SCRATCH
024 @SCRATCH
025 @TRIS_C
026 @I2C_WRITEU_1_59_60_4000000.P1
026 @delay_ms1.P2
 
0004 @delay_ms1
0019 @I2C_WRITEU_1_59_60_4000000
0029 main
0029 @cinit
 
Project Files:
D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.c
D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.h
C:\Program Files\PICC\devices\16F873.h
 
Units:
D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.c (main)
 
Compiler Settings:
Processor: PIC16F873
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.err
INHX8: D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.hex
Symbols: D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.sym
List: D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.lst
Debug/COFF: D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.cof
Call Tree: D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.tre
Statistics: D:\KAKLIK\projekty\programy\PIC_C\PICcam\873\camerus.sta
/programy/C/PIC/PICcam/873/camerus.tre
0,0 → 1,16
ÀÄcamerus
ÀÄmain 0/153 Ram=0
ÃÄ??0??
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÃÄ@I2C_WRITEU_1_59_60_4000000 0/16 Ram=1
ÀÄ@delay_ms1 0/21 Ram=1
/programy/C/PIC/hack/hack.BAK
0,0 → 1,11
#include <16F88.h>
#device *=16
#device ICD=TRUE
#device adc=8
#fuses NOWDT,INTRC , NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO
//#fuses NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO
#use delay(clock=4000000,RESTART_WDT)
//#use rs232(baud=2400,xmit=PIN_B3)
//#use rs232(DEBUGGER)
#use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8)
 
/programy/C/PIC/hack/hack.HEX
0,0 → 1,202
:10000000000000308A00422BFF00030E8301A10094
:100010007F08A0000A08A8008A01A00E0408A20018
:100020007708A3007808A4007908A5007A08A6003C
:100030007B08A700831383128C308400001C2228C5
:100040000C183B288C308400801C28288C183D28F4
:10005000220884002308F7002408F8002508F90086
:100060002608FA002708FB0028088A00210E8300D2
:10007000FF0E7F0E09008A11E0288A11E3280A107A
:100080008A100A1182074834413443344B342034F7
:10009000763431342E343034003400340A108A106F
:1000A0000A1182070A340D340A340D3425347334AE
:1000B00000340A108A100A11820725344C34753432
:1000C0006534343420342B34203425344C347534A6
:1000D000203447344F3400340A108A100A11820742
:1000E00025344C3475346534343420342B34203486
:1000F00025344C347534203452344534503445342E
:10010000413454342034253475340A340D340034E9
:100110000A108A100A11820725344C34753465346C
:10012000343420342B34203425344C34753420348A
:100130004834413443344B3400340A108A100A11D5
:10014000820725344C3475346534343420342B34F0
:10015000203425344C347534203474346934633499
:100160006B34733400340A108A100A118207253464
:100170004C347534203478342034313420347034A5
:10018000723465347334633461346C3465340034F0
:100190000A108A100A1182074534723472346F349F
:1001A000723400340A108A100A11820725344C3444
:1001B000753420347434693463346B3473340034EC
:1001C0000C108A1128288C108A11282842308400AB
:1001D000831300080319FD280130F800BF30F70031
:1001E0006400F70BF028F80BEE284A30F700F70B05
:1001F000F72800006400800BEC2800348316861179
:10020000831286110830F800000000000000F81783
:100210001829F813CC0C03188615031C86117817BF
:1002200018297813F80B0A29000000000000861531
:100230000130F7008401840B1B29F70B1A290D30BC
:100240008400840B212900000000F81B0929781B79
:10025000112900340408F8000830F7008316061549
:100260008312061D352983163029C101F717482945
:10027000F7134829031006190314C10C77174829EE
:100280007713F70B3A29780884004108F8005D29B4
:10029000013084000030F71B5530F800F80B4E2970
:1002A000840B4A290D30F71B0330F800F80B562950
:1002B000F71B3829771B40293A298A11C12BCB011A
:1002C0000408CA004B10831B4B14440EF038C600C0
:1002D000C607E23EC700323EC90044080F39C707CF
:1002E000C707C907E93EC800C807C807430E0F394A
:1002F000C807C907C80DC90DC909C90D43080F3979
:10030000C907C60D0730C5000A30C907C803031C5A
:100310008529C807C703031C8929C707C603031C0F
:100320008D29C607C503031C91294530840083131A
:1003300007304A058407493004020319C12900081F
:10034000F700031DA9294A1ABF29CA19AB29203071
:10035000AC290830CA003030F707C4010408C300D4
:100360004410831B44147708C5007708CC00FE2096
:10037000430884008313441883174508F700840A50
:100380009B290008F7003030F7077708CC00FE20E3
:1003900000344708F80146020318D1294608F7003F
:1003A000DD29F7010830C800C60DF70D47087702B0
:1003B0000318F700F80DC80BD42900344513C512F3
:1003C0004408C6006430C700C9217708C400780813
:1003D000031D082AC51A082AC519162A451BF6291D
:1003E0004518F6294519F629C51B162A451C022A67
:1003F000C51B162A451B022A4518162A4519022A2A
:10040000C51B162A2030451E3030CC00FE20162A8F
:10041000C516C51F122A78088000F8002D30CC00C0
:10042000FE20C51330307807CC00FE20451B212A62
:100430004408C6000A30C700C9217708C400451720
:10044000E729C51F262A2D30CC00FE203030440776
:10045000CC00FE208A118F2C1030F700FA01CD015C
:10046000CA0CC90C031C3A2A4B08FA070318CD0A18
:100470004C08CD07CD0CFA0CF90CF80CF70B302A10
:100480008A11B62AC701C5010A30C600C401C301DA
:1004900041084204031D502A0030F800F900412BA6
:1004A0004708C70A410784008313421883170008CE
:1004B000C80048082D3C031D692A0130C5004708C3
:1004C000C70A410784008313421883170008C80035
:1004D000762A48082B3C031D762A4708C70A41079D
:1004E00084008313421883170008C80048082F3C73
:1004F0000318322B4808393C031C322B4808303C87
:10050000031DA22A4708410784008313421883175A
:100510000008783C0319962A470841078400831392
:10052000421883170008583C031DA22A1030C60049
:10053000C70A4708C70A4107840083134218831774
:100540000008C80046080A3C031DC92A48082F3C79
:100550000318C82A4808393C031CC82ACA010A30B3
:10056000C9004408CC004308CB002C2A3030480294
:100570007807C3007908C4000318C40A4708C70AEB
:10058000410784008313421883170008C800A62A75
:10059000322B4608103C031D322B4808603C0318E0
:1005A000D82A48087A3C031CD82A4808DF39D92AB7
:1005B0004808C80048082F3C0318E22A4808393C7C
:1005C0000318EA2A4808403C0318322B4808463CE6
:1005D000031C322B48082F3C0318072B4808393CD2
:1005E000031C072B430DC900440DCA00C90DCA0DD9
:1005F000C90DCA0DC90DCA0DF030C9053030480209
:100600004907C3004A08C4000318C40A1C2B430D41
:10061000C900440DCA00C90DCA0DC90DCA0DC90DC6
:10062000CA0DF030C905413048020A3E4907C300EF
:100630004A08C4000318C40A4708C70A41078400CF
:100640008313421883170008C800603C03182F2B3F
:1006500048087A3C031C2F2B4808DF39302B480808
:10066000C800DA2A46080A3C031D3D2B450B3D2BEA
:10067000C309C409C30A0319C40A4308F80044089B
:10068000F9000034840183131F30830583161F1281
:100690009F121B0880399B0007309C0005086400EE
:1006A0001C0883120D13603083168F00861183128D
:1006B0008615A901AA010130AB00AC01AD01AE0164
:1006C00083161F129F121B0880399B0083121F1074
:1006D00094128316061186140612003083129400B9
:1006E000831694000108C7392838810087308312A7
:1006F00090000030F800920000308316920007301E
:100700009C00050864000230F700F70B852B000001
:1007100000001C0883120D1383169D0162308F00A8
:1007200064308312C200E620C10141084E20C10A94
:10073000F700CC00FE2004304102031D952BC201BE
:1007400042083F2000380319A92BC20ACC00FE2022
:10075000A02B8316061283120612831686128312AA
:100760008612BF010130BE00BD01BC010A30CC00C1
:10077000FE200D30CC00FE203E30CC00FE20C0011B
:100780002A297808B1003108CC00FE204008C00AB0
:10079000323E840083133108800031080D3C031978
:1007A000D52B4008093C0318C02B32304007840089
:1007B000831380010A30CC00FE200D30CC00FE20D7
:1007C0003208673A0319F12B153A0319602C1A3ACB
:1007D0000319E92C013A0319712D193A0319A82DAF
:1007E000EB2D103084003D08C4003C08C3005F219D
:1007F0000330C10041085920C10AF700CC00FE2097
:1008000008304102031DFA2B103084003F08C40059
:100810003E08C3005F212030CC00FE204730CC00D2
:10082000FE204F30CC00FE20B001AF0130083D0269
:10083000031C3C2C031D202C3C082F0203183C2CCD
:100840008F018E010F08FA000E08F7000F087A02D8
:10085000031D222C7708C1007A08C2004208273CF9
:10086000031C382C031D222C41080F3C0318222C9A
:10087000AF0A0319B00A162C8F018E010F08FA0077
:100880000E08F7000F087A02031D3E2C7708C100FE
:100890007A08C20042083F02031C542C031D3E2C60
:1008A0003E084102031C3E2C8316061283120616D4
:1008B0000130C200E62083160612831206121A2E99
:1008C000C0014008C00AC100103084003D08C400C7
:1008D0003C08C3005F210330C20042086C20C20AFA
:1008E000F700CC00FE2008304202031D6D2C1030B2
:1008F00084003F08C4003E08C3005F210B30C300E2
:1009000043086C20C30AF700CC00FE2013304302DA
:10091000031D802C4108C4001830C500DE290A30B0
:10092000CC00FE200D30CC00FE20B001AF0130081D
:100930003D02031CBD2C031DA12C3C082F020318F3
:10094000BD2C8F018E010F08FA000E08F7000F086A
:100950007A02031DA32C7708C1007A08C20042085E
:10096000273C031CB92C031DA32C41080F3C031882
:10097000A32CAF0A0319B00A972C8F018E010F0820
:10098000FA000E08F7000F087A02031DBF2C770843
:10099000C1007A08C20042083F02031CD52C031D87
:1009A000BF2C3E084102031CBF2C83160612831283
:1009B00006161430C200E6208316061283120612B1
:1009C0000830C100FA30C200E620C10BE22C612CD5
:1009D0001A2E103084003D08C4003C08C3005F217B
:1009E0000330C10041088820C10AF700CC00FE2076
:1009F00008304102031DF22C103084003F08C4006F
:100A00003E08C3005F210B30C20042088820C20AA2
:100A1000F700CC00FE2010304202031D052DB0016E
:100A2000AF0130083D02031C372D031D1B2D3C0870
:100A30002F020318372D8F018E010F08FA000E08C0
:100A4000F7000F087A02031D1D2D7708C1007A08F0
:100A5000C2004208273C031C332D031D1D2D4108F5
:100A60000F3C03181D2DAF0A0319B00A112D8F0179
:100A70008E010F08FA000E08F7000F087A02031D16
:100A8000392D7708C1007A08C20042083F02031CD2
:100A90004F2D031D392D3E084102031C392D8316AD
:100AA00006128312061683160613831206130A30E3
:100AB000C200E62083168612831286162830C100F3
:100AC000FA30C200E620C10B602D83168612831215
:100AD00086128316061283120612831606178312D5
:100AE0001A2EC10141083F20003803197B2DC10A8D
:100AF000CC00FE20722D0A30CC00FE200D30CC0040
:100B0000FE20103084003D08C4003C08C3005F2173
:100B10000330C10041089D20C10AF700CC00FE202F
:100B200008304102031D8A2D103084003F08C400A4
:100B30003E08C3005F210B30C20042089D20C20A5C
:100B4000F700CC00FE2011304202031D9D2D1A2E0D
:100B500033082F3C0318DF2D3308393C031CDF2DED
:100B6000C2013330C10042227908BD007808BC00C0
:100B7000103084003D08C4003C08C3005F210330EE
:100B8000C1004108B320C10AF700CC00FE200730A5
:100B90004102031DC12D0430C2003030CC00FE20C4
:100BA000C20BCD2D0730C3004308B320C30AF700A2
:100BB000CC00FE2010304302031DD42DEA2DC101CC
:100BC0004108C820C10AF700CC00FE2005304102D0
:100BD000031DE02D1A2E32082F3C03180F2E320869
:100BE000393C031C0F2EC2013230C1004222790869
:100BF000BF007808BE00103084003F08C4003E08E3
:100C0000C3005F210330C1004108D220C10AF700B0
:100C1000CC00FE2009304102031D042E1A2EC10112
:100C20004108C820C10AF700CC00FE20053041026F
:100C3000031D102EB62B83160612831206120230E5
:100C4000C1009630C200E620C10B212E8316061289
:100C5000831206160230C1009630C200E620C10B96
:060C60002C2E1B2E322E8B
:04400E003137FC3F0B
:00000001FF
;PIC16F88
/programy/C/PIC/hack/hack.LST
0,0 → 1,2662
CCS PCM C Compiler, Version 3.221, 27853 12-III-06 16:36
 
Filename: D:\KAKLIK\programy\PIC_C\hack\hack.LST
 
ROM used: 1587 words (41%)
Largest free fragment is 1792
RAM used: 41 (11%) at main() level
51 (14%) worst case
Stack: 3 worst case (2 in main + 1 for interrupts)
 
*
0000: NOP
0001: MOVLW 00
0002: MOVWF 0A
0003: GOTO 342
0004: MOVWF 7F
0005: SWAPF 03,W
0006: CLRF 03
0007: MOVWF 21
0008: MOVF 7F,W
0009: MOVWF 20
000A: MOVF 0A,W
000B: MOVWF 28
000C: CLRF 0A
000D: SWAPF 20,F
000E: MOVF 04,W
000F: MOVWF 22
0010: MOVF 77,W
0011: MOVWF 23
0012: MOVF 78,W
0013: MOVWF 24
0014: MOVF 79,W
0015: MOVWF 25
0016: MOVF 7A,W
0017: MOVWF 26
0018: MOVF 7B,W
0019: MOVWF 27
001A: BCF 03.7
001B: BCF 03.5
001C: MOVLW 8C
001D: MOVWF 04
001E: BTFSS 00.0
001F: GOTO 022
0020: BTFSC 0C.0
0021: GOTO 03B
0022: MOVLW 8C
0023: MOVWF 04
0024: BTFSS 00.1
0025: GOTO 028
0026: BTFSC 0C.1
0027: GOTO 03D
0028: MOVF 22,W
0029: MOVWF 04
002A: MOVF 23,W
002B: MOVWF 77
002C: MOVF 24,W
002D: MOVWF 78
002E: MOVF 25,W
002F: MOVWF 79
0030: MOVF 26,W
0031: MOVWF 7A
0032: MOVF 27,W
0033: MOVWF 7B
0034: MOVF 28,W
0035: MOVWF 0A
0036: SWAPF 21,W
0037: MOVWF 03
0038: SWAPF 7F,F
0039: SWAPF 7F,W
003A: RETFIE
003B: BCF 0A.3
003C: GOTO 0E0
003D: BCF 0A.3
003E: GOTO 0E3
.................... #include ".\hack.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... #device *=16
.................... #device ICD=TRUE
.................... #device adc=8
.................... #fuses NOWDT,INTRC , NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO
.................... //#fuses NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO
.................... #use delay(clock=4000000,RESTART_WDT)
*
00E6: MOVLW 42
00E7: MOVWF 04
00E8: BCF 03.7
00E9: MOVF 00,W
00EA: BTFSC 03.2
00EB: GOTO 0FD
00EC: MOVLW 01
00ED: MOVWF 78
00EE: MOVLW BF
00EF: MOVWF 77
00F0: CLRWDT
00F1: DECFSZ 77,F
00F2: GOTO 0F0
00F3: DECFSZ 78,F
00F4: GOTO 0EE
00F5: MOVLW 4A
00F6: MOVWF 77
00F7: DECFSZ 77,F
00F8: GOTO 0F7
00F9: NOP
00FA: CLRWDT
00FB: DECFSZ 00,F
00FC: GOTO 0EC
00FD: RETLW 00
.................... //#use rs232(baud=2400,xmit=PIN_B3)
.................... //#use rs232(DEBUGGER)
.................... #use rs232(baud=1200,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8)
00FE: BSF 03.5
00FF: BCF 06.3
0100: BCF 03.5
0101: BCF 06.3
0102: MOVLW 08
0103: MOVWF 78
0104: NOP
0105: NOP
0106: NOP
0107: BSF 78.7
0108: GOTO 118
0109: BCF 78.7
010A: RRF 4C,F
010B: BTFSC 03.0
010C: BSF 06.3
010D: BTFSS 03.0
010E: BCF 06.3
010F: BSF 78.6
0110: GOTO 118
0111: BCF 78.6
0112: DECFSZ 78,F
0113: GOTO 10A
0114: NOP
0115: NOP
0116: NOP
0117: BSF 06.3
0118: MOVLW 01
0119: MOVWF 77
011A: CLRF 04
011B: DECFSZ 04,F
011C: GOTO 11B
011D: DECFSZ 77,F
011E: GOTO 11A
011F: MOVLW 0D
0120: MOVWF 04
0121: DECFSZ 04,F
0122: GOTO 121
0123: NOP
0124: NOP
0125: BTFSC 78.7
0126: GOTO 109
0127: BTFSC 78.6
0128: GOTO 111
0129: RETLW 00
012A: MOVF 04,W
012B: MOVWF 78
012C: MOVLW 08
012D: MOVWF 77
012E: BSF 03.5
012F: BSF 06.2
0130: BCF 03.5
0131: BTFSS 06.2
0132: GOTO 135
0133: BSF 03.5
0134: GOTO 130
0135: CLRF 41
0136: BSF 77.7
0137: GOTO 148
0138: BCF 77.7
0139: GOTO 148
013A: BCF 03.0
013B: BTFSC 06.2
013C: BSF 03.0
013D: RRF 41,F
013E: BSF 77.6
013F: GOTO 148
0140: BCF 77.6
0141: DECFSZ 77,F
0142: GOTO 13A
0143: MOVF 78,W
0144: MOVWF 04
0145: MOVF 41,W
0146: MOVWF 78
0147: GOTO 15D
0148: MOVLW 01
0149: MOVWF 04
014A: MOVLW 00
014B: BTFSC 77.7
014C: MOVLW 55
014D: MOVWF 78
014E: DECFSZ 78,F
014F: GOTO 14E
0150: DECFSZ 04,F
0151: GOTO 14A
0152: MOVLW 0D
0153: BTFSC 77.7
0154: MOVLW 03
0155: MOVWF 78
0156: DECFSZ 78,F
0157: GOTO 156
0158: BTFSC 77.7
0159: GOTO 138
015A: BTFSC 77.6
015B: GOTO 140
015C: GOTO 13A
015D: BCF 0A.3
015E: GOTO 3C1 (RETURN)
....................
....................
.................... #include <stdlib.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDLIB
.................... #define _STDLIB
....................
.................... //---------------------------------------------------------------------------
.................... // Definitions and types
.................... //---------------------------------------------------------------------------
....................
.................... #ifndef RAND_MAX
.................... #define RAND_MAX 32767 // The value of which is the maximum value
.................... // ... returned by the rand function
.................... #endif
....................
.................... typedef struct {
.................... signed int quot;
.................... signed int rem;
.................... } div_t;
....................
.................... typedef struct {
.................... signed long quot;
.................... signed long rem;
.................... } ldiv_t;
....................
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(int *)==1
.................... #define ptrdiff_t int
.................... #else
.................... #define ptrdiff_t long
.................... #endif
....................
.................... #define size_t int
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
....................
.................... //---------------------------------------------------------------------------
.................... // String conversion functions
.................... //---------------------------------------------------------------------------
....................
.................... /* Standard template: float atof(char * s)
.................... * converts the initial portion of the string s to a float.
.................... * returns the converted value if any, 0 otherwise
.................... */
.................... float atof(char * s);
....................
.................... /* Standard template: signed int atoi(char * s)
.................... * converts the initial portion of the string s to a signed int
.................... * returns the converted value if any, 0 otherwise
.................... */
.................... signed int atoi(char *s);
....................
.................... /* Syntax: signed int32 atoi32(char * s)
.................... converts the initial portion of the string s to a signed int32
.................... returns the converted value if any, 0 otherwise*/
.................... signed int32 atoi32(char *s);
....................
.................... /* Standard template: signed long atol(char * s)
.................... * converts the initial portion of the string s to a signed long
.................... * returns the converted value if any, 0 otherwise
.................... */
.................... signed long atol(char *s);
....................
.................... /* Standard template: float strtol(char * s,char *endptr)
.................... * converts the initial portion of the string s to a float
.................... * returns the converted value if any, 0 otherwise
.................... * the final string is returned in the endptr, if endptr is not null
.................... */
.................... float strtod(char *s,char *endptr);
....................
.................... /* Standard template: long strtoul(char * s,char *endptr,signed int base)
.................... * converts the initial portion of the string s, represented as an
.................... * integral value of radix base to a signed long.
.................... * Returns the converted value if any, 0 otherwise
.................... * the final string is returned in the endptr, if endptr is not null
.................... */
.................... signed long strtol(char *s,char *endptr,signed int base);
....................
.................... /* Standard template: long strtoul(char * s,char *endptr,signed int base)
.................... * converts the initial portion of the string s, represented as an
.................... * integral value of radix base to a unsigned long.
.................... * returns the converted value if any, 0 otherwise
.................... * the final string is returned in the endptr, if endptr is not null
.................... */
.................... long strtoul(char *s,char *endptr,signed int base);
....................
.................... //---------------------------------------------------------------------------
.................... // Pseudo-random sequence generation functions
.................... //---------------------------------------------------------------------------
....................
.................... /* The rand function computes a sequence of pseudo-random integers in
.................... * the range 0 to RAND_MAX
.................... *
.................... * Parameters:
.................... * (none)
.................... *
.................... * Returns:
.................... * The pseudo-random integer
.................... */
.................... long rand(void);
....................
.................... /* The srand function uses the argument as a seed for a new sequence of
.................... * pseudo-random numbers to be returned by subsequent calls to rand.
.................... *
.................... * Parameters:
.................... * [in] seed: The seed value to start from. You might need to pass
.................... *
.................... * Returns:
.................... * (none)
.................... *
.................... * Remarks
.................... * The srand function sets the starting point for generating
.................... * a series of pseudorandom integers. To reinitialize the
.................... * generator, use 1 as the seed argument. Any other value for
.................... * seed sets the generator to a random starting point. rand
.................... * retrieves the pseudorandom numbers that are generated.
.................... * Calling rand before any call to srand generates the same
.................... * sequence as calling srand with seed passed as 1.
.................... * Usually, you need to pass a time here from outer source
.................... * so that the numbers will be different every time you run.
.................... */
.................... void srand(unsigned int32 seed);
....................
.................... //---------------------------------------------------------------------------
.................... // Memory management functions
.................... //---------------------------------------------------------------------------
....................
.................... // Comming soon
....................
.................... //---------------------------------------------------------------------------
.................... // Communication with the environment
.................... //---------------------------------------------------------------------------
....................
.................... /* The function returns 0 always
.................... */
.................... signed int system(char *string);
....................
.................... //---------------------------------------------------------------------------
.................... // Searching and sorting utilities
.................... //---------------------------------------------------------------------------
....................
.................... /* Performs a binary search of a sorted array..
.................... *
.................... * Parameters:
.................... * [in] key: Object to search for
.................... * [in] base: Pointer to base of search data
.................... * [in] num: Number of elements
.................... * [in] width: Width of elements
.................... * [in] compare: Function that compares two elements
.................... *
.................... * Returns:
.................... * bsearch returns a pointer to an occurrence of key in the array pointed
.................... * to by base. If key is not found, the function returns NULL. If the
.................... * array is not in order or contains duplicate records with identical keys,
.................... * the result is unpredictable.
.................... */
.................... //void *bsearch(const void *key, const void *base, size_t num, size_t width,
.................... // int (*compare)(const void *, const void *));
....................
.................... /* Performs the shell-metzner sort (not the quick sort algorithm). The contents
.................... * of the array are sorted into ascending order according to a comparison
.................... * function pointed to by compar.
.................... *
.................... * Parameters:
.................... * [in] base: Pointer to base of search data
.................... * [in] num: Number of elements
.................... * [in] width: Width of elements
.................... * [in] compare: Function that compares two elements
.................... *
.................... * Returns:
.................... * (none)
.................... */
.................... //void *qsort(const void *base, size_t num, size_t width,
.................... // int (*compare)(const void *, const void *));
....................
.................... //---------------------------------------------------------------------------
.................... // Integer arithmetic functions
.................... //---------------------------------------------------------------------------
....................
.................... #define labs abs
....................
.................... div_t div(signed int numer,signed int denom);
.................... ldiv_t ldiv(signed long numer,signed long denom);
....................
.................... //---------------------------------------------------------------------------
.................... // Multibyte character functions
.................... //---------------------------------------------------------------------------
....................
.................... // Not supported
....................
.................... //---------------------------------------------------------------------------
.................... // Multibyte string functions
.................... //---------------------------------------------------------------------------
....................
.................... // Not supported
....................
....................
.................... //---------------------------------------------------------------------------
.................... // Internal implementation
.................... //---------------------------------------------------------------------------
....................
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(int *)==1
.................... #define ptrdiff_t int
.................... #else
.................... #define ptrdiff_t long
.................... #endif
....................
.................... #define size_t int
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
.................... #include <string.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STRING
.................... #define _STRING
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(int *)==1
.................... #define ptrdiff_t int
.................... #else
.................... #define ptrdiff_t long
.................... #endif
....................
.................... #define size_t int
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
.................... #include <ctype.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _CTYPE
.................... #define _CTYPE
....................
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz")
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isdigit(x) isamong(x,"0123456789")
.................... #define isspace(x) (x==' ')
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")
.................... #define iscntrl(x) (x<' ')
.................... #define isprint(x) (x>=' ')
.................... #define isgraph(x) (x>' ')
.................... #define ispunct(x) ((x>' ')&&!isalnum(x))
....................
.................... #endif
....................
....................
....................
....................
....................
.................... //////////////////////////////////////////////
.................... //// Uncomment the following define to ////
.................... //// allow some functions to use a ////
.................... //// quicker algorithm, but use more ROM ////
.................... //// ////
.................... //// #define FASTER_BUT_MORE_ROM ////
.................... //////////////////////////////////////////////
....................
....................
....................
.................... /*Copying functions*/
.................... /* standard template:
.................... void *memmove(void *s1, void *s2, size_t n).
.................... Copies max of n characters safely (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *memmove(void *s1,char *s2,size_t n)
.................... {
.................... char *sc1;
.................... char *sc2;
.................... sc1=s1;
.................... sc2=s2;
.................... if(sc2<sc1 && sc1 <sc2 +n)
.................... for(sc1+=n,sc2+=n;0<n;--n)
.................... *--sc1=*--sc2;
.................... else
.................... for(;0<n;--n)
.................... *sc1++=*sc2++;
.................... return s1;
.................... }
....................
.................... /* compiler ignored the name 'strcpy()'; perhaps, it's reserved?
.................... Standard template: char *strcpy(char *s1, const char *s2)
.................... copies the string s2 including the null character to s1*/
....................
.................... char *strcopy(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s2 != 0; s++, s2++) {
.................... *s = *s2;
.................... }
.................... *s = *s2;
.................... return(s1);
.................... }
....................
.................... /* standard template:
.................... char *strncpy(char *s1, const char *s2, size_t n).
.................... Copies max of n characters (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *strncpy(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(s1);
.................... }
.................... /***********************************************************/
....................
.................... /*concatenation functions*/
.................... /* standard template: char *strcat(char *s1, const char *s2)
.................... appends s2 to s1*/
....................
.................... char *strcat(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0')
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n)
.................... appends not more than n characters from s2 to s1*/
....................
.................... char *strncat(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0' && 0<n)
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... --n;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
....................
.................... /***********************************************************/
....................
....................
.................... /*comparison functions*/
.................... /* standard template: signed int memcmp(void *s1, void *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int memcmp(void * s1,char *s2,size_t n)
.................... {
.................... char *su1, *su2;
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)
.................... {
.................... if(*su1!=*su2)
.................... return ((*su1<*su2)?1:+1);
.................... }
.................... return 0;
.................... }
....................
.................... /* standard template: int strcmp(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int strcmp(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ?-1: 1);
.................... }
.................... /* standard template: int strcoll(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int strcoll(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ?-1: 1);
.................... }
....................
.................... /* standard template:
.................... int strncmp(const char *s1, const char *s2, size_t n).
.................... Compares max of n characters (not following 0) from s1 to s2;
.................... returns same as strcmp */
....................
.................... signed int strncmp(char *s1, char *s2, size_t n)
.................... {
.................... for (; n > 0; s1++, s2++, n--)
.................... if (*s1 != *s2)
.................... return((*s1 <*s2) ?-1: 1);
.................... else if (*s1 == '\0')
.................... return(0);
.................... return(0);
.................... }
.................... /* standard template:
.................... int strxfrm(const char *s1, const char *s2, size_t n).
.................... transforms maximum of n characters from s2 and places them into s1*/
.................... size_t strxfrm(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
.................... int n1;
.................... n1=n;
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(n1);
.................... }
....................
....................
....................
....................
....................
.................... /***********************************************************/
.................... /*Search functions*/
.................... /* standard template: void *memchr(const char *s, int c).
.................... Finds first occurrence of c in n characters of s */
....................
.................... char *memchr(void *s,int c,size_t n)
.................... {
.................... char uc;
.................... char *su;
.................... uc=c;
.................... for(su=s;0<n;++su,--n)
.................... if(*su==uc)
.................... return su;
.................... return NULL;
.................... }
....................
.................... /* standard template: char *strchr(const char *s, int c).
.................... Finds first occurrence of c in s */
....................
.................... char *strchr(char *s, int c)
.................... {
.................... for (; *s != c; s++)
.................... if (*s == '\0')
.................... return(0);
.................... return(s);
.................... }
.................... /* standard template:
.................... size_t strcspn(const char *s1, const char *s2).
.................... Computes length of max initial segment of s1 that
.................... consists entirely of characters NOT from s2*/
....................
.................... int *strcspn(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; *sc2 != 0; sc2++)
.................... if (*sc1 == *sc2)
.................... return(sc1 - s1);
.................... return(sc1 - s1);
.................... }
.................... /* standard template:
.................... char *strpbrk(const char *s1, const char *s2).
.................... Locates first occurence of any character from s2 in s1;
.................... returns s1 if s2 is empty string */
....................
.................... char *strpbrk(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; *sc2 != 0; sc2++)
.................... if (*sc1 == *sc2)
.................... return(sc1);
.................... return(0);
.................... }
....................
....................
.................... /* standard template: char *strrchr(const char *s, int c).
.................... Finds last occurrence of c in s */
....................
.................... char *strrchr(char *s, int c)
.................... {
.................... char *p;
....................
.................... for (p = 0; ; s++)
.................... {
.................... if (*s == c)
.................... p = s;
.................... if (*s == '\0')
.................... return(p);
.................... }
.................... }
.................... /* computes length of max initial segment of s1 consisting
.................... entirely of characters from s2 */
....................
.................... int *strspn(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; ; sc2++)
.................... if (*sc2 == '\0')
.................... return(sc1 - s1);
.................... else if (*sc1 == *sc2)
.................... break;
.................... return(sc1 - s1);
.................... }
.................... /* standard template:
.................... char *strstr(const char *s1, const char *s2);
.................... Locates first occurence of character sequence s2 in s1;
.................... returns 0 if s2 is empty string
....................
.................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the
.................... file to use the faster algorithm */
.................... char *strstr(char *s1, char *s2)
.................... {
.................... char *s, *t;
....................
.................... #ifdef FASTER_BUT_MORE_ROM
.................... if (*s2 == '\0')
.................... return(s1);
.................... #endif
....................
.................... while (*s1)
.................... {
.................... for(s = s1, t = s2; *t && *s == *t; ++s, ++t);
....................
.................... if (*t == '\0')
.................... return s1;
.................... ++s1;
.................... #ifdef FASTER_BUT_MORE_ROM
.................... while(*s1 != '\0' && *s1 != *s2)
.................... ++s1;
.................... #endif
.................... }
.................... return 0;
.................... }
....................
.................... /* standard template: char *strtok(char *s1, const char *s2).
....................
.................... Finds next token in s1 delimited by a character from separator
.................... string s2 (which can be different from call to call). First call
.................... starts at beginning of s1 searching for first character NOT
.................... contained in s2; returns 0 if none is found.
.................... If one is found, it is the start of first token (return value).
.................... Function then searches from there for a character contained in s2.
.................... If none is found, current token extends to end of s1, and subsequent
.................... searches for a token will return 0. If one is found, it is
.................... overwritten by '\0', which terminates current token. Function saves
.................... pointer to following character from which next search will start.
.................... Each subsequent call, with 0 as first argument, starts searching
.................... from saved pointer */
....................
.................... char *strtok(char *s1, char *s2)
.................... {
.................... char *beg, *end;
.................... static char *save;
*
0359: CLRF 29
035A: CLRF 2A
....................
.................... beg = (s1)?s1: save;
.................... beg += strspn(beg, s2);
.................... if (*beg == '\0')
.................... {
.................... *save = ' ';
.................... return(0);
.................... }
.................... end = strpbrk(beg, s2);
.................... if (*end != '\0')
.................... {
.................... *end = '\0';
.................... end++;
.................... }
.................... save = end;
.................... return(beg);
.................... }
....................
.................... /*****************************************************************/
.................... /*Miscellaneous functions*/
.................... /* standard template
.................... maps error number in errnum to an error message string
.................... Returns: Pointer to string
.................... */
.................... #ifdef _ERRNO
.................... char * strerror(int errnum)
.................... {
.................... char s[15];
.................... switch( errnum)
.................... {
.................... case 0:
.................... strcpy(s,"no errors");
.................... return s;
.................... case EDOM :
.................... strcpy(s,"domain error");
.................... return s;
.................... case ERANGE:
.................... strcpy(s,"range error");
.................... return s;
.................... }
.................... }
.................... #ENDIF
.................... /* standard template: size_t strlen(const char *s).
.................... Computes length of s1 (preceding terminating 0) */
....................
.................... int *strlen(char *s)
.................... {
.................... char *sc;
....................
.................... for (sc = s; *sc != 0; sc++);
.................... return(sc - s);
.................... }
....................
.................... /* standard template: size_t stricmp(const char *s1, const char *s2).
.................... Compares s1 to s2 ignoring case (upper vs. lower) */
....................
.................... signed int stricmp(char *s1, char *s2)
.................... {
.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));
.................... s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ?-1: 1);
.................... }
....................
....................
.................... /* standard template: char *strlwr(char *s).
.................... Replaces uppercase letters by lowercase;
.................... returns pointer to new string s */
....................
.................... char *strlwr(char *s)
.................... {
.................... char *p;
....................
.................... for (p = s; *p != '\0'; p++)
.................... if (*p >= 'A' && *p <='Z')
.................... *p += 'a' - 'A';
.................... return(s);
.................... }
....................
....................
.................... /************************************************************/
....................
....................
.................... #endif
....................
....................
.................... div_t div(signed int numer,signed int denom)
.................... {
.................... div_t val;
.................... val.quot = numer / denom;
.................... val.rem = numer - (denom * val.quot);
.................... return (val);
.................... }
....................
.................... ldiv_t ldiv(signed long numer,signed long denom)
.................... {
.................... ldiv_t val;
.................... val.quot = numer / denom;
.................... val.rem = numer - (denom * val.quot);
.................... return (val);
.................... }
....................
.................... float atof(char * s)
.................... {
.................... float pow10 = 1.0;
.................... float result = 0.0;
.................... int sign = 0;
.................... char c;
.................... int ptr = 0;
....................
.................... c = s[ptr++];
....................
.................... if ((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {
.................... if(c == '-') {
.................... sign = 1;
.................... c = s[ptr++];
.................... }
.................... if(c == '+')
.................... c = s[ptr++];
....................
.................... while((c >= '0' && c <= '9')) {
.................... result = 10*result + c - '0';
.................... c = s[ptr++];
.................... }
....................
.................... if (c == '.') {
.................... c = s[ptr++];
.................... while((c >= '0' && c <= '9')) {
.................... pow10 = pow10*10;
.................... result += (c - '0')/pow10;
.................... c = s[ptr++];
.................... }
.................... }
....................
.................... }
....................
.................... if (sign == 1)
.................... result = -1*result;
.................... return(result);
.................... }
....................
.................... signed int atoi(char *s)
.................... {
.................... signed int result;
.................... int sign, base, index;
.................... char c;
....................
.................... index = 0;
.................... sign = 0;
.................... base = 10;
.................... result = 0;
....................
.................... if (!s)
.................... return 0;
.................... // Omit all preceeding alpha characters
.................... c = s[index++];
....................
.................... // increase index if either positive or negative sign is detected
.................... if (c == '-')
.................... {
.................... sign = 1; // Set the sign to negative
.................... c = s[index++];
.................... }
.................... else if (c == '+')
.................... {
.................... c = s[index++];
.................... }
....................
.................... if (c >= '0' && c <= '9')
.................... {
....................
.................... // Check for hexa number
.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X'))
.................... {
.................... base = 16;
.................... index++;
.................... c = s[index++];
.................... }
....................
.................... // The number is a decimal number
.................... if (base == 10)
.................... {
.................... while (c >= '0' && c <= '9')
.................... {
.................... result = 10*result + (c - '0');
.................... c = s[index++];
.................... }
.................... }
.................... else if (base == 16) // The number is a hexa number
.................... {
.................... c = toupper(c);
.................... while ( (c >= '0' && c <= '9') || (c >= 'A' && c<='F'))
.................... {
.................... if (c >= '0' && c <= '9')
.................... result = (result << 4) + (c - '0');
.................... else
.................... result = (result << 4) + (c - 'A' + 10);
....................
.................... c = s[index++];
.................... c = toupper(c);
.................... }
.................... }
.................... }
....................
.................... if (sign == 1 && base == 10)
.................... result = -result;
....................
.................... return(result);
.................... }
....................
.................... signed long atol(char *s)
.................... {
.................... signed long result;
.................... int sign, base, index;
.................... char c;
....................
.................... index = 0;
*
0242: CLRF 47
.................... sign = 0;
0243: CLRF 45
.................... base = 10;
0244: MOVLW 0A
0245: MOVWF 46
.................... result = 0;
0246: CLRF 44
0247: CLRF 43
....................
.................... if (!s)
0248: MOVF 41,W
0249: IORWF 42,W
024A: BTFSS 03.2
024B: GOTO 250
.................... return 0;
024C: MOVLW 00
024D: MOVWF 78
024E: MOVWF 79
024F: GOTO 341
.................... c = s[index++];
0250: MOVF 47,W
0251: INCF 47,F
0252: ADDWF 41,W
0253: MOVWF 04
0254: BCF 03.7
0255: BTFSC 42.0
0256: BSF 03.7
0257: MOVF 00,W
0258: MOVWF 48
....................
.................... // increase index if either positive or negative sign is detected
.................... if (c == '-')
0259: MOVF 48,W
025A: SUBLW 2D
025B: BTFSS 03.2
025C: GOTO 269
.................... {
.................... sign = 1; // Set the sign to negative
025D: MOVLW 01
025E: MOVWF 45
.................... c = s[index++];
025F: MOVF 47,W
0260: INCF 47,F
0261: ADDWF 41,W
0262: MOVWF 04
0263: BCF 03.7
0264: BTFSC 42.0
0265: BSF 03.7
0266: MOVF 00,W
0267: MOVWF 48
.................... }
.................... else if (c == '+')
0268: GOTO 276
0269: MOVF 48,W
026A: SUBLW 2B
026B: BTFSS 03.2
026C: GOTO 276
.................... {
.................... c = s[index++];
026D: MOVF 47,W
026E: INCF 47,F
026F: ADDWF 41,W
0270: MOVWF 04
0271: BCF 03.7
0272: BTFSC 42.0
0273: BSF 03.7
0274: MOVF 00,W
0275: MOVWF 48
.................... }
....................
.................... if (c >= '0' && c <= '9')
0276: MOVF 48,W
0277: SUBLW 2F
0278: BTFSC 03.0
0279: GOTO 332
027A: MOVF 48,W
027B: SUBLW 39
027C: BTFSS 03.0
027D: GOTO 332
.................... {
.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X'))
027E: MOVF 48,W
027F: SUBLW 30
0280: BTFSS 03.2
0281: GOTO 2A2
0282: MOVF 47,W
0283: ADDWF 41,W
0284: MOVWF 04
0285: BCF 03.7
0286: BTFSC 42.0
0287: BSF 03.7
0288: MOVF 00,W
0289: SUBLW 78
028A: BTFSC 03.2
028B: GOTO 296
028C: MOVF 47,W
028D: ADDWF 41,W
028E: MOVWF 04
028F: BCF 03.7
0290: BTFSC 42.0
0291: BSF 03.7
0292: MOVF 00,W
0293: SUBLW 58
0294: BTFSS 03.2
0295: GOTO 2A2
.................... {
.................... base = 16;
0296: MOVLW 10
0297: MOVWF 46
.................... index++;
0298: INCF 47,F
.................... c = s[index++];
0299: MOVF 47,W
029A: INCF 47,F
029B: ADDWF 41,W
029C: MOVWF 04
029D: BCF 03.7
029E: BTFSC 42.0
029F: BSF 03.7
02A0: MOVF 00,W
02A1: MOVWF 48
.................... }
....................
.................... // The number is a decimal number
.................... if (base == 10)
02A2: MOVF 46,W
02A3: SUBLW 0A
02A4: BTFSS 03.2
02A5: GOTO 2C9
.................... {
.................... while (c >= '0' && c <= '9')
.................... {
02A6: MOVF 48,W
02A7: SUBLW 2F
02A8: BTFSC 03.0
02A9: GOTO 2C8
02AA: MOVF 48,W
02AB: SUBLW 39
02AC: BTFSS 03.0
02AD: GOTO 2C8
.................... result = 10*result + (c - '0');
02AE: CLRF 4A
02AF: MOVLW 0A
02B0: MOVWF 49
02B1: MOVF 44,W
02B2: MOVWF 4C
02B3: MOVF 43,W
02B4: MOVWF 4B
02B5: GOTO 22C
02B6: MOVLW 30
02B7: SUBWF 48,W
02B8: ADDWF 78,W
02B9: MOVWF 43
02BA: MOVF 79,W
02BB: MOVWF 44
02BC: BTFSC 03.0
02BD: INCF 44,F
.................... c = s[index++];
02BE: MOVF 47,W
02BF: INCF 47,F
02C0: ADDWF 41,W
02C1: MOVWF 04
02C2: BCF 03.7
02C3: BTFSC 42.0
02C4: BSF 03.7
02C5: MOVF 00,W
02C6: MOVWF 48
.................... }
02C7: GOTO 2A6
.................... }
.................... else if (base == 16) // The number is a hexa number
02C8: GOTO 332
02C9: MOVF 46,W
02CA: SUBLW 10
02CB: BTFSS 03.2
02CC: GOTO 332
.................... {
.................... c = toupper(c);
02CD: MOVF 48,W
02CE: SUBLW 60
02CF: BTFSC 03.0
02D0: GOTO 2D8
02D1: MOVF 48,W
02D2: SUBLW 7A
02D3: BTFSS 03.0
02D4: GOTO 2D8
02D5: MOVF 48,W
02D6: ANDLW DF
02D7: GOTO 2D9
02D8: MOVF 48,W
02D9: MOVWF 48
.................... while ( (c >= '0' && c <= '9') || (c >= 'A' && c <='F'))
.................... {
02DA: MOVF 48,W
02DB: SUBLW 2F
02DC: BTFSC 03.0
02DD: GOTO 2E2
02DE: MOVF 48,W
02DF: SUBLW 39
02E0: BTFSC 03.0
02E1: GOTO 2EA
02E2: MOVF 48,W
02E3: SUBLW 40
02E4: BTFSC 03.0
02E5: GOTO 332
02E6: MOVF 48,W
02E7: SUBLW 46
02E8: BTFSS 03.0
02E9: GOTO 332
.................... if (c >= '0' && c <= '9')
02EA: MOVF 48,W
02EB: SUBLW 2F
02EC: BTFSC 03.0
02ED: GOTO 307
02EE: MOVF 48,W
02EF: SUBLW 39
02F0: BTFSS 03.0
02F1: GOTO 307
.................... result = (result << 4) + (c - '0');
02F2: RLF 43,W
02F3: MOVWF 49
02F4: RLF 44,W
02F5: MOVWF 4A
02F6: RLF 49,F
02F7: RLF 4A,F
02F8: RLF 49,F
02F9: RLF 4A,F
02FA: RLF 49,F
02FB: RLF 4A,F
02FC: MOVLW F0
02FD: ANDWF 49,F
02FE: MOVLW 30
02FF: SUBWF 48,W
0300: ADDWF 49,W
0301: MOVWF 43
0302: MOVF 4A,W
0303: MOVWF 44
0304: BTFSC 03.0
0305: INCF 44,F
.................... else
0306: GOTO 31C
.................... result = (result << 4) + (c - 'A' + 10);
0307: RLF 43,W
0308: MOVWF 49
0309: RLF 44,W
030A: MOVWF 4A
030B: RLF 49,F
030C: RLF 4A,F
030D: RLF 49,F
030E: RLF 4A,F
030F: RLF 49,F
0310: RLF 4A,F
0311: MOVLW F0
0312: ANDWF 49,F
0313: MOVLW 41
0314: SUBWF 48,W
0315: ADDLW 0A
0316: ADDWF 49,W
0317: MOVWF 43
0318: MOVF 4A,W
0319: MOVWF 44
031A: BTFSC 03.0
031B: INCF 44,F
....................
.................... c = s[index++];c = toupper(c);
031C: MOVF 47,W
031D: INCF 47,F
031E: ADDWF 41,W
031F: MOVWF 04
0320: BCF 03.7
0321: BTFSC 42.0
0322: BSF 03.7
0323: MOVF 00,W
0324: MOVWF 48
0325: SUBLW 60
0326: BTFSC 03.0
0327: GOTO 32F
0328: MOVF 48,W
0329: SUBLW 7A
032A: BTFSS 03.0
032B: GOTO 32F
032C: MOVF 48,W
032D: ANDLW DF
032E: GOTO 330
032F: MOVF 48,W
0330: MOVWF 48
.................... }
0331: GOTO 2DA
.................... }
.................... }
....................
.................... if (base == 10 && sign == 1)
0332: MOVF 46,W
0333: SUBLW 0A
0334: BTFSS 03.2
0335: GOTO 33D
0336: DECFSZ 45,W
0337: GOTO 33D
.................... result = -result;
0338: COMF 43,F
0339: COMF 44,F
033A: INCF 43,F
033B: BTFSC 03.2
033C: INCF 44,F
....................
.................... return(result);
033D: MOVF 43,W
033E: MOVWF 78
033F: MOVF 44,W
0340: MOVWF 79
.................... }
0341: RETLW 00
....................
.................... /* A fast routine to multiply by 10
.................... */
.................... signed int32 mult_with10(int32 num)
.................... {
.................... return ( (num << 1) + (num << 3) );
.................... }
....................
.................... signed int32 atoi32(char *s)
.................... {
.................... signed int32 result;
.................... int sign, base, index;
.................... char c;
....................
.................... index = 0;
.................... sign = 0;
.................... base = 10;
.................... result = 0;
....................
.................... if (!s)
.................... return 0;
.................... c = s[index++];
....................
.................... // increase index if either positive or negative sign is detected
.................... if (c == '-')
.................... {
.................... sign = 1; // Set the sign to negative
.................... c = s[index++];
.................... }
.................... else if (c == '+')
.................... {
.................... c = s[index++];
.................... }
....................
.................... if (c >= '0' && c <= '9')
.................... {
.................... if (c == '0' && (s[index] == 'x' || s[index] == 'X'))
.................... {
.................... base = 16;
.................... index++;
.................... c = s[index++];
.................... }
....................
.................... // The number is a decimal number
.................... if (base == 10)
.................... {
.................... while (c >= '0' && c <= '9') {
.................... result = (result << 1) + (result << 3); // result *= 10;
.................... result += (c - '0');
.................... c = s[index++];
.................... }
.................... }
.................... else if (base == 16) // The number is a hexa number
.................... {
.................... c = toupper(c);
.................... while ((c >= '0' && c <= '9') || (c >= 'A' && c <='F'))
.................... {
.................... if (c >= '0' && c <= '9')
.................... result = (result << 4) + (c - '0');
.................... else
.................... result = (result << 4) + (c - 'A' + 10);
....................
.................... c = s[index++];c = toupper(c);
.................... }
.................... }
.................... }
....................
.................... if (base == 10 && sign == 1)
.................... result = -result;
....................
.................... return(result);
.................... }
....................
.................... float strtod(char *s,char *endptr) {
.................... float pow10 = 1.0;
.................... float result = 0.0;
.................... int sign = 0, point = 0;
.................... char c;
.................... int ptr = 0;
....................
.................... if (!s)
.................... return 0;
.................... c=s[ptr++];
....................
....................
.................... while((c>='0' && c<='9') || c=='+' || c=='-' || c=='.') {
.................... if(c == '-') {
.................... sign = 1;
.................... c = s[ptr++];
.................... }
....................
.................... while((c >= '0' && c <= '9') && point == 0) {
.................... result = 10*result + c - '0';
.................... c = s[ptr++];
.................... }
....................
.................... if (c == '.') {
.................... point = 1;
.................... c = s[ptr++];
.................... }
....................
.................... while((c >= '0' && c <= '9') && point == 1) {
.................... pow10 = pow10*10;
.................... result += (c - '0')/pow10;
.................... c = s[ptr++];
.................... }
....................
.................... if (c == '+') {
.................... c = s[ptr++];
.................... }
.................... }
....................
.................... if (sign == 1)
.................... result = -1*result;
.................... if(endptr)
.................... {
.................... if (ptr) {
.................... ptr--;
.................... *((char *)endptr)=s+ptr;
.................... }
.................... else
.................... *((char *)endptr)=s;
.................... }
....................
.................... return(result);
.................... }
....................
.................... long strtoul(char *s,char *endptr,signed int base)
.................... {
.................... char *sc,*s1,*sd;
.................... unsigned long x=0;
.................... char sign;
.................... char digits[]="0123456789abcdefghijklmnopqstuvwxyz";
.................... for(sc=s;isspace(*sc);++sc);
.................... sign=*sc=='-'||*sc=='+'?sc++:'+';
.................... if(sign=='-')
.................... {
.................... if (endptr)
.................... {
.................... *((char *)endptr)=s;
.................... }
.................... return 0;
.................... }
....................
.................... if (base <0 || base ==1|| base >36) // invalid base
.................... {
.................... if (endptr)
.................... {
.................... *((char *)endptr)=s;
.................... }
.................... return 0;
.................... }
.................... else if (base)
.................... {
.................... if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X'))
.................... sc+=2;
.................... if(base==8 && *sc =='0')
.................... sc+=1;
.................... if(base==2 && *sc =='0'&&sc[1]=='b')
.................... sc+=2;
....................
.................... }
.................... else if(*sc!='0') // base is 0, find base
.................... base=10;
.................... else if (sc[1]=='x' || sc[1]=='X')
.................... base =16,sc+=2;
.................... else if(sc[1]=='b')
.................... base=2,sc+=2;
.................... else
.................... base=8;
.................... for (s1=sc;*sc=='0';++sc);// skip leading zeroes
.................... sd=memchr(digits,tolower(*sc),base);
.................... for(; sd!=0; )
.................... {
.................... x=x*base+(int16)(sd-digits);
.................... ++sc;
.................... sd=memchr(digits,tolower(*sc),base);
.................... }
.................... if(s1==sc)
.................... {
.................... if (endptr)
.................... {
.................... *((char *)endptr)=s;
.................... }
.................... return 0;
.................... }
.................... if (endptr)
.................... *((char *)endptr)=sc;
.................... return x;
.................... }
....................
....................
.................... signed long strtol(char *s,char *endptr,signed int base)
.................... {
.................... char *sc,*s1,*sd;
.................... signed long x=0;
.................... char sign;
.................... char digits[]="0123456789abcdefghijklmnopqstuvwxyz";
.................... for(sc=s;isspace(*sc);++sc);
.................... sign=*sc=='-'||*sc=='+'?sc++:'+';
.................... if (base <0 || base ==1|| base >36) // invalid base
.................... {
.................... if (endptr)
.................... {
.................... *((char *)endptr)=s;
.................... }
.................... return 0;
.................... }
.................... else if (base)
.................... {
.................... if(base==16 && *sc =='0'&&(sc[1]=='x' || sc[1]=='X'))
.................... sc+=2;
.................... if(base==8 && *sc =='0')
.................... sc+=1;
.................... if(base==2 && *sc =='0'&&sc[1]=='b')
.................... sc+=2;
....................
.................... }
.................... else if(*sc!='0') // base is 0, find base
.................... base=10;
.................... else if (sc[1]=='x' || sc[1]=='X')
.................... base =16,sc+=2;
.................... else if(sc[1]=='b')
.................... base=2,sc+=2;
.................... else
.................... base=8;
.................... for (s1=sc;*sc=='0';++sc);// skip leading zeroes
....................
.................... sd=memchr(digits,tolower(*sc),base);
.................... for(;sd!=0;)
.................... {
.................... x=x*base+(int16)(sd-digits);
.................... ++sc;
.................... sd=memchr(digits,tolower(*sc),base);
.................... }
.................... if(s1==sc)
.................... {
.................... if (endptr)
.................... {
.................... *((char *)endptr)=s;
.................... }
.................... return 0;
.................... }
.................... if(sign=='-')
.................... x =-x;
.................... if (endptr)
.................... *((char *)endptr)=sc;
.................... return x;
.................... }
....................
.................... signed int system(char *string)
.................... {
.................... return 0;
.................... }
....................
.................... int mblen(char *s,size_t n)
.................... {
.................... return strlen(s);
.................... }
....................
.................... int mbtowc(wchar_t *pwc,char *s,size_t n)
.................... {
.................... *pwc=*s;
.................... return 1;
.................... }
....................
.................... int wctomb(char *s,wchar_t wchar)
.................... {
.................... *s=wchar;
.................... return 1;
.................... }
....................
.................... size_t mbstowcs(wchar_t *pwcs,char *s,size_t n)
.................... {
.................... strncpy(pwcs,s,n);
.................... return strlen(pwcs);
.................... }
....................
.................... size_t wcstombs(char *s,wchar_t *pwcs,size_t n)
.................... {
.................... strncpy(s,pwcs,n);
.................... return strlen(s);
.................... }
....................
.................... //---------------------------------------------------------------------------
.................... // The random number implementation
.................... //---------------------------------------------------------------------------
....................
.................... unsigned int32 _Randseed = 1;
*
035B: MOVLW 01
035C: MOVWF 2B
035D: CLRF 2C
035E: CLRF 2D
035F: CLRF 2E
....................
.................... long rand(void)
.................... {
.................... _Randseed = _Randseed * 1103515245 + 12345;
.................... return ((unsigned long)(_Randseed >> 16) % RAND_MAX);
.................... }
....................
.................... void srand(unsigned int32 seed)
.................... {
.................... _Randseed = seed;
.................... }
....................
.................... //---------------------------------------------------------------------------
.................... // Searching and sorting utilities implementation
.................... //---------------------------------------------------------------------------
....................
.................... typedef signed int (*_Cmpfun)(char * p1,char * p2);
....................
.................... void qsort(char * qdata, int qitems, int qsize, _Cmpfun cmp) {
.................... int m,j,i,l;
.................... short done;
.................... BYTE t[16];
....................
.................... m = qitems/2;
.................... while( m > 0 ) {
.................... for(j=0; j<(qitems-m); ++j) {
.................... i = j;
.................... do
.................... {
.................... done=TRUE;
.................... l = i+m;
.................... if( (*cmp)(qdata+i*qsize, qdata+l*qsize) > 0 ) {
.................... memcpy(t, qdata+i*qsize, qsize);
.................... memcpy(qdata+i*qsize, qdata+l*qsize, qsize);
.................... memcpy(qdata+l*qsize, t, qsize);
.................... if(m <= i)
.................... i -= m;
.................... done = FALSE;
.................... }
.................... } while(!done);
.................... }
.................... m = m/2;
.................... }
.................... }
....................
....................
.................... char *bsearch(char *key, char *base, size_t num, size_t width,_Cmpfun cmp)
.................... {
.................... char *p, *q;
.................... size_t n;
.................... size_t pivot;
.................... signed int val;
....................
.................... p = base;
.................... n = num;
....................
.................... while (n > 0)
.................... {
.................... pivot = n >> 1;
.................... q = p + width * pivot;
....................
.................... val = (*cmp)(key, q);
....................
.................... if (val < 0)
.................... n = pivot;
.................... else if (val == 0)
.................... return ((char *)q);
.................... else {
.................... p = q + width;
.................... n -= pivot + 1;
.................... }
.................... }
....................
.................... return NULL; // There's no match
.................... }
....................
....................
.................... #endif
....................
....................
.................... #define SYNC PIN_B4 // Spousteni oscyloskopu
.................... #define HACK PIN_B5 // Zkratovani napajeni SmartCard
.................... #define CLOCK PIN_B6 // Hodiny ze SmartCard
....................
.................... #int_TIMER1
.................... TIMER1_isr()
.................... {
....................
.................... }
....................
*
00E0: BCF 0C.0
00E1: BCF 0A.3
00E2: GOTO 028
.................... #int_TIMER2
.................... TIMER2_isr()
.................... {
....................
.................... }
....................
00E3: BCF 0C.1
00E4: BCF 0A.3
00E5: GOTO 028
.................... void main()
.................... {
*
0342: CLRF 04
0343: BCF 03.7
0344: MOVLW 1F
0345: ANDWF 03,F
0346: BSF 03.5
0347: BCF 1F.4
0348: BCF 1F.5
0349: MOVF 1B,W
034A: ANDLW 80
034B: MOVWF 1B
034C: MOVLW 07
034D: MOVWF 1C
034E: MOVF 05,W
034F: CLRWDT
0350: MOVF 1C,W
0351: BCF 03.5
0352: BCF 0D.6
0353: MOVLW 60
0354: BSF 03.5
0355: MOVWF 0F
0356: BCF 06.3
0357: BCF 03.5
0358: BSF 06.3
.................... unsigned int16 i;
.................... char ch;
.................... char string[10];
.................... const char ver[]={"HACK v1.0\0"};
.................... unsigned int16 prescale;
.................... unsigned int16 ticks;
.................... int n;
....................
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
*
0360: BSF 03.5
0361: BCF 1F.4
0362: BCF 1F.5
0363: MOVF 1B,W
0364: ANDLW 80
0365: MOVWF 1B
.................... setup_adc(ADC_OFF);
0366: BCF 03.5
0367: BCF 1F.0
.................... setup_spi(FALSE);
0368: BCF 14.5
0369: BSF 03.5
036A: BCF 06.2
036B: BSF 06.1
036C: BCF 06.4
036D: MOVLW 00
036E: BCF 03.5
036F: MOVWF 14
0370: BSF 03.5
0371: MOVWF 14
.................... setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
0372: MOVF 01,W
0373: ANDLW C7
0374: IORLW 28
0375: MOVWF 01
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
0376: MOVLW 87
0377: BCF 03.5
0378: MOVWF 10
.................... // setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
.................... setup_timer_2(T2_DISABLED,0,1);
0379: MOVLW 00
037A: MOVWF 78
037B: MOVWF 12
037C: MOVLW 00
037D: BSF 03.5
037E: MOVWF 12
.................... setup_comparator(NC_NC_NC_NC);
037F: MOVLW 07
0380: MOVWF 1C
0381: MOVF 05,W
0382: CLRWDT
0383: MOVLW 02
0384: MOVWF 77
0385: DECFSZ 77,F
0386: GOTO 385
0387: NOP
0388: NOP
0389: MOVF 1C,W
038A: BCF 03.5
038B: BCF 0D.6
.................... setup_vref(FALSE);
038C: BSF 03.5
038D: CLRF 1D
.................... // enable_interrupts(INT_TIMER1);
.................... // enable_interrupts(INT_TIMER2);
.................... // enable_interrupts(GLOBAL);
....................
.................... setup_oscillator(OSC_4MHZ|OSC_INTRC); // 4 MHz interni RC oscilator
038E: MOVLW 62
038F: MOVWF 0F
....................
.................... delay_ms(100);
0390: MOVLW 64
0391: BCF 03.5
0392: MOVWF 42
0393: CALL 0E6
.................... printf("\n\r\n\r%s", ver);
0394: CLRF 41
0395: MOVF 41,W
0396: CALL 04E
0397: INCF 41,F
0398: MOVWF 77
0399: MOVWF 4C
039A: CALL 0FE
039B: MOVLW 04
039C: SUBWF 41,W
039D: BTFSS 03.2
039E: GOTO 395
039F: CLRF 42
03A0: MOVF 42,W
03A1: CALL 03F
03A2: IORLW 00
03A3: BTFSC 03.2
03A4: GOTO 3A9
03A5: INCF 42,F
03A6: MOVWF 4C
03A7: CALL 0FE
03A8: GOTO 3A0
.................... output_low(SYNC);
03A9: BSF 03.5
03AA: BCF 06.4
03AB: BCF 03.5
03AC: BCF 06.4
.................... output_low(HACK);
03AD: BSF 03.5
03AE: BCF 06.5
03AF: BCF 03.5
03B0: BCF 06.5
.................... ticks=1;
03B1: CLRF 3F
03B2: MOVLW 01
03B3: MOVWF 3E
.................... prescale=0;
03B4: CLRF 3D
03B5: CLRF 3C
....................
.................... while(true)
.................... {
.................... printf("\n\r>");
03B6: MOVLW 0A
03B7: MOVWF 4C
03B8: CALL 0FE
03B9: MOVLW 0D
03BA: MOVWF 4C
03BB: CALL 0FE
03BC: MOVLW 3E
03BD: MOVWF 4C
03BE: CALL 0FE
.................... n=0;
03BF: CLRF 40
.................... do
.................... {
.................... ch=getchar();
03C0: GOTO 12A
03C1: MOVF 78,W
03C2: MOVWF 31
.................... printf("%c",ch);
03C3: MOVF 31,W
03C4: MOVWF 4C
03C5: CALL 0FE
.................... string[n++]=ch;
03C6: MOVF 40,W
03C7: INCF 40,F
03C8: ADDLW 32
03C9: MOVWF 04
03CA: BCF 03.7
03CB: MOVF 31,W
03CC: MOVWF 00
.................... } while((13 != ch) && (n < 10));
03CD: MOVF 31,W
03CE: SUBLW 0D
03CF: BTFSC 03.2
03D0: GOTO 3D5
03D1: MOVF 40,W
03D2: SUBLW 09
03D3: BTFSC 03.0
03D4: GOTO 3C0
.................... string[n]=0;
03D5: MOVLW 32
03D6: ADDWF 40,W
03D7: MOVWF 04
03D8: BCF 03.7
03D9: CLRF 00
.................... printf("\n\r");
03DA: MOVLW 0A
03DB: MOVWF 4C
03DC: CALL 0FE
03DD: MOVLW 0D
03DE: MOVWF 4C
03DF: CALL 0FE
.................... switch(string[0])
.................... {
03E0: MOVF 32,W
03E1: XORLW 67
03E2: BTFSC 03.2
03E3: GOTO 3F1
03E4: XORLW 15
03E5: BTFSC 03.2
03E6: GOTO 460
03E7: XORLW 1A
03E8: BTFSC 03.2
03E9: GOTO 4E9
03EA: XORLW 01
03EB: BTFSC 03.2
03EC: GOTO 571
03ED: XORLW 19
03EE: BTFSC 03.2
03EF: GOTO 5A8
03F0: GOTO 5EB
.................... case 'g': // GO
.................... printf("%Lue4 + %Lu GO", prescale, ticks);
03F1: MOVLW 10
03F2: MOVWF 04
03F3: MOVF 3D,W
03F4: MOVWF 44
03F5: MOVF 3C,W
03F6: MOVWF 43
03F7: CALL 15F
03F8: MOVLW 03
03F9: MOVWF 41
03FA: MOVF 41,W
03FB: CALL 059
03FC: INCF 41,F
03FD: MOVWF 77
03FE: MOVWF 4C
03FF: CALL 0FE
0400: MOVLW 08
0401: SUBWF 41,W
0402: BTFSS 03.2
0403: GOTO 3FA
0404: MOVLW 10
0405: MOVWF 04
0406: MOVF 3F,W
0407: MOVWF 44
0408: MOVF 3E,W
0409: MOVWF 43
040A: CALL 15F
040B: MOVLW 20
040C: MOVWF 4C
040D: CALL 0FE
040E: MOVLW 47
040F: MOVWF 4C
0410: CALL 0FE
0411: MOVLW 4F
0412: MOVWF 4C
0413: CALL 0FE
.................... for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };
0414: CLRF 30
0415: CLRF 2F
0416: MOVF 30,W
0417: SUBWF 3D,W
0418: BTFSS 03.0
0419: GOTO 43C
041A: BTFSS 03.2
041B: GOTO 420
041C: MOVF 3C,W
041D: SUBWF 2F,W
041E: BTFSC 03.0
041F: GOTO 43C
0420: CLRF 0F
0421: CLRF 0E
0422: MOVF 0F,W
0423: MOVWF 7A
0424: MOVF 0E,W
0425: MOVWF 77
0426: MOVF 0F,W
0427: SUBWF 7A,W
0428: BTFSS 03.2
0429: GOTO 422
042A: MOVF 77,W
042B: MOVWF 41
042C: MOVF 7A,W
042D: MOVWF 42
042E: MOVF 42,W
042F: SUBLW 27
0430: BTFSS 03.0
0431: GOTO 438
0432: BTFSS 03.2
0433: GOTO 422
0434: MOVF 41,W
0435: SUBLW 0F
0436: BTFSC 03.0
0437: GOTO 422
0438: INCF 2F,F
0439: BTFSC 03.2
043A: INCF 30,F
043B: GOTO 416
.................... set_timer1(0); while ( get_timer1() < ticks ) ;
043C: CLRF 0F
043D: CLRF 0E
043E: MOVF 0F,W
043F: MOVWF 7A
0440: MOVF 0E,W
0441: MOVWF 77
0442: MOVF 0F,W
0443: SUBWF 7A,W
0444: BTFSS 03.2
0445: GOTO 43E
0446: MOVF 77,W
0447: MOVWF 41
0448: MOVF 7A,W
0449: MOVWF 42
044A: MOVF 42,W
044B: SUBWF 3F,W
044C: BTFSS 03.0
044D: GOTO 454
044E: BTFSS 03.2
044F: GOTO 43E
0450: MOVF 3E,W
0451: SUBWF 41,W
0452: BTFSS 03.0
0453: GOTO 43E
.................... output_high(SYNC);
0454: BSF 03.5
0455: BCF 06.4
0456: BCF 03.5
0457: BSF 06.4
.................... delay_ms(1);
0458: MOVLW 01
0459: MOVWF 42
045A: CALL 0E6
.................... output_low(SYNC);
045B: BSF 03.5
045C: BCF 06.4
045D: BCF 03.5
045E: BCF 06.4
.................... break;
045F: GOTO 61A
....................
.................... case 'r': // REPEAT
.................... n=0;
0460: CLRF 40
.................... while(true)
.................... {
.................... printf("%Lue4 + %Lu REPEAT %u\n\r", prescale, ticks, n++);
0461: MOVF 40,W
0462: INCF 40,F
0463: MOVWF 41
0464: MOVLW 10
0465: MOVWF 04
0466: MOVF 3D,W
0467: MOVWF 44
0468: MOVF 3C,W
0469: MOVWF 43
046A: CALL 15F
046B: MOVLW 03
046C: MOVWF 42
046D: MOVF 42,W
046E: CALL 06C
046F: INCF 42,F
0470: MOVWF 77
0471: MOVWF 4C
0472: CALL 0FE
0473: MOVLW 08
0474: SUBWF 42,W
0475: BTFSS 03.2
0476: GOTO 46D
0477: MOVLW 10
0478: MOVWF 04
0479: MOVF 3F,W
047A: MOVWF 44
047B: MOVF 3E,W
047C: MOVWF 43
047D: CALL 15F
047E: MOVLW 0B
047F: MOVWF 43
0480: MOVF 43,W
0481: CALL 06C
0482: INCF 43,F
0483: MOVWF 77
0484: MOVWF 4C
0485: CALL 0FE
0486: MOVLW 13
0487: SUBWF 43,W
0488: BTFSS 03.2
0489: GOTO 480
048A: MOVF 41,W
048B: MOVWF 44
048C: MOVLW 18
048D: MOVWF 45
048E: GOTO 1DE
048F: MOVLW 0A
0490: MOVWF 4C
0491: CALL 0FE
0492: MOVLW 0D
0493: MOVWF 4C
0494: CALL 0FE
.................... for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };
0495: CLRF 30
0496: CLRF 2F
0497: MOVF 30,W
0498: SUBWF 3D,W
0499: BTFSS 03.0
049A: GOTO 4BD
049B: BTFSS 03.2
049C: GOTO 4A1
049D: MOVF 3C,W
049E: SUBWF 2F,W
049F: BTFSC 03.0
04A0: GOTO 4BD
04A1: CLRF 0F
04A2: CLRF 0E
04A3: MOVF 0F,W
04A4: MOVWF 7A
04A5: MOVF 0E,W
04A6: MOVWF 77
04A7: MOVF 0F,W
04A8: SUBWF 7A,W
04A9: BTFSS 03.2
04AA: GOTO 4A3
04AB: MOVF 77,W
04AC: MOVWF 41
04AD: MOVF 7A,W
04AE: MOVWF 42
04AF: MOVF 42,W
04B0: SUBLW 27
04B1: BTFSS 03.0
04B2: GOTO 4B9
04B3: BTFSS 03.2
04B4: GOTO 4A3
04B5: MOVF 41,W
04B6: SUBLW 0F
04B7: BTFSC 03.0
04B8: GOTO 4A3
04B9: INCF 2F,F
04BA: BTFSC 03.2
04BB: INCF 30,F
04BC: GOTO 497
.................... set_timer1(0); while ( get_timer1() < ticks ) ;
04BD: CLRF 0F
04BE: CLRF 0E
04BF: MOVF 0F,W
04C0: MOVWF 7A
04C1: MOVF 0E,W
04C2: MOVWF 77
04C3: MOVF 0F,W
04C4: SUBWF 7A,W
04C5: BTFSS 03.2
04C6: GOTO 4BF
04C7: MOVF 77,W
04C8: MOVWF 41
04C9: MOVF 7A,W
04CA: MOVWF 42
04CB: MOVF 42,W
04CC: SUBWF 3F,W
04CD: BTFSS 03.0
04CE: GOTO 4D5
04CF: BTFSS 03.2
04D0: GOTO 4BF
04D1: MOVF 3E,W
04D2: SUBWF 41,W
04D3: BTFSS 03.0
04D4: GOTO 4BF
.................... output_high(SYNC);
04D5: BSF 03.5
04D6: BCF 06.4
04D7: BCF 03.5
04D8: BSF 06.4
.................... delay_ms(20);
04D9: MOVLW 14
04DA: MOVWF 42
04DB: CALL 0E6
.................... output_low(SYNC);
04DC: BSF 03.5
04DD: BCF 06.4
04DE: BCF 03.5
04DF: BCF 06.4
.................... delay_ms(2000);
04E0: MOVLW 08
04E1: MOVWF 41
04E2: MOVLW FA
04E3: MOVWF 42
04E4: CALL 0E6
04E5: DECFSZ 41,F
04E6: GOTO 4E2
.................... };
04E7: GOTO 461
.................... break;
04E8: GOTO 61A
....................
.................... case 'h': // HACK
.................... printf("%Lue4 + %Lu HACK", prescale, ticks);
04E9: MOVLW 10
04EA: MOVWF 04
04EB: MOVF 3D,W
04EC: MOVWF 44
04ED: MOVF 3C,W
04EE: MOVWF 43
04EF: CALL 15F
04F0: MOVLW 03
04F1: MOVWF 41
04F2: MOVF 41,W
04F3: CALL 088
04F4: INCF 41,F
04F5: MOVWF 77
04F6: MOVWF 4C
04F7: CALL 0FE
04F8: MOVLW 08
04F9: SUBWF 41,W
04FA: BTFSS 03.2
04FB: GOTO 4F2
04FC: MOVLW 10
04FD: MOVWF 04
04FE: MOVF 3F,W
04FF: MOVWF 44
0500: MOVF 3E,W
0501: MOVWF 43
0502: CALL 15F
0503: MOVLW 0B
0504: MOVWF 42
0505: MOVF 42,W
0506: CALL 088
0507: INCF 42,F
0508: MOVWF 77
0509: MOVWF 4C
050A: CALL 0FE
050B: MOVLW 10
050C: SUBWF 42,W
050D: BTFSS 03.2
050E: GOTO 505
.................... for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };
050F: CLRF 30
0510: CLRF 2F
0511: MOVF 30,W
0512: SUBWF 3D,W
0513: BTFSS 03.0
0514: GOTO 537
0515: BTFSS 03.2
0516: GOTO 51B
0517: MOVF 3C,W
0518: SUBWF 2F,W
0519: BTFSC 03.0
051A: GOTO 537
051B: CLRF 0F
051C: CLRF 0E
051D: MOVF 0F,W
051E: MOVWF 7A
051F: MOVF 0E,W
0520: MOVWF 77
0521: MOVF 0F,W
0522: SUBWF 7A,W
0523: BTFSS 03.2
0524: GOTO 51D
0525: MOVF 77,W
0526: MOVWF 41
0527: MOVF 7A,W
0528: MOVWF 42
0529: MOVF 42,W
052A: SUBLW 27
052B: BTFSS 03.0
052C: GOTO 533
052D: BTFSS 03.2
052E: GOTO 51D
052F: MOVF 41,W
0530: SUBLW 0F
0531: BTFSC 03.0
0532: GOTO 51D
0533: INCF 2F,F
0534: BTFSC 03.2
0535: INCF 30,F
0536: GOTO 511
.................... set_timer1(0); while ( get_timer1() < ticks ) ;
0537: CLRF 0F
0538: CLRF 0E
0539: MOVF 0F,W
053A: MOVWF 7A
053B: MOVF 0E,W
053C: MOVWF 77
053D: MOVF 0F,W
053E: SUBWF 7A,W
053F: BTFSS 03.2
0540: GOTO 539
0541: MOVF 77,W
0542: MOVWF 41
0543: MOVF 7A,W
0544: MOVWF 42
0545: MOVF 42,W
0546: SUBWF 3F,W
0547: BTFSS 03.0
0548: GOTO 54F
0549: BTFSS 03.2
054A: GOTO 539
054B: MOVF 3E,W
054C: SUBWF 41,W
054D: BTFSS 03.0
054E: GOTO 539
.................... output_high(SYNC);
054F: BSF 03.5
0550: BCF 06.4
0551: BCF 03.5
0552: BSF 06.4
.................... output_low(CLOCK);
0553: BSF 03.5
0554: BCF 06.6
0555: BCF 03.5
0556: BCF 06.6
.................... delay_ms(10);
0557: MOVLW 0A
0558: MOVWF 42
0559: CALL 0E6
.................... output_high(HACK);
055A: BSF 03.5
055B: BCF 06.5
055C: BCF 03.5
055D: BSF 06.5
.................... delay_ms(10000);
055E: MOVLW 28
055F: MOVWF 41
0560: MOVLW FA
0561: MOVWF 42
0562: CALL 0E6
0563: DECFSZ 41,F
0564: GOTO 560
.................... output_low(HACK);
0565: BSF 03.5
0566: BCF 06.5
0567: BCF 03.5
0568: BCF 06.5
.................... output_low(SYNC);
0569: BSF 03.5
056A: BCF 06.4
056B: BCF 03.5
056C: BCF 06.4
.................... input(CLOCK);
056D: BSF 03.5
056E: BSF 06.6
.................... break;
056F: BCF 03.5
0570: GOTO 61A
....................
.................... case 'i': // Info
.................... printf("%s\n\r", ver);
0571: CLRF 41
0572: MOVF 41,W
0573: CALL 03F
0574: IORLW 00
0575: BTFSC 03.2
0576: GOTO 57B
0577: INCF 41,F
0578: MOVWF 4C
0579: CALL 0FE
057A: GOTO 572
057B: MOVLW 0A
057C: MOVWF 4C
057D: CALL 0FE
057E: MOVLW 0D
057F: MOVWF 4C
0580: CALL 0FE
.................... printf("%Lue4 + %Lu ticks", prescale, ticks);
0581: MOVLW 10
0582: MOVWF 04
0583: MOVF 3D,W
0584: MOVWF 44
0585: MOVF 3C,W
0586: MOVWF 43
0587: CALL 15F
0588: MOVLW 03
0589: MOVWF 41
058A: MOVF 41,W
058B: CALL 09D
058C: INCF 41,F
058D: MOVWF 77
058E: MOVWF 4C
058F: CALL 0FE
0590: MOVLW 08
0591: SUBWF 41,W
0592: BTFSS 03.2
0593: GOTO 58A
0594: MOVLW 10
0595: MOVWF 04
0596: MOVF 3F,W
0597: MOVWF 44
0598: MOVF 3E,W
0599: MOVWF 43
059A: CALL 15F
059B: MOVLW 0B
059C: MOVWF 42
059D: MOVF 42,W
059E: CALL 09D
059F: INCF 42,F
05A0: MOVWF 77
05A1: MOVWF 4C
05A2: CALL 0FE
05A3: MOVLW 11
05A4: SUBWF 42,W
05A5: BTFSS 03.2
05A6: GOTO 59D
.................... break;
05A7: GOTO 61A
....................
.................... case 'p':
.................... if (isdigit(string[1]))
05A8: MOVF 33,W
05A9: SUBLW 2F
05AA: BTFSC 03.0
05AB: GOTO 5DF
05AC: MOVF 33,W
05AD: SUBLW 39
05AE: BTFSS 03.0
05AF: GOTO 5DF
.................... {
.................... prescale=atol(string+1);
05B0: CLRF 42
05B1: MOVLW 33
05B2: MOVWF 41
05B3: CALL 242
05B4: MOVF 79,W
05B5: MOVWF 3D
05B6: MOVF 78,W
05B7: MOVWF 3C
.................... printf("%Lu x 10000 prescale", prescale);
05B8: MOVLW 10
05B9: MOVWF 04
05BA: MOVF 3D,W
05BB: MOVWF 44
05BC: MOVF 3C,W
05BD: MOVWF 43
05BE: CALL 15F
05BF: MOVLW 03
05C0: MOVWF 41
05C1: MOVF 41,W
05C2: CALL 0B3
05C3: INCF 41,F
05C4: MOVWF 77
05C5: MOVWF 4C
05C6: CALL 0FE
05C7: MOVLW 07
05C8: SUBWF 41,W
05C9: BTFSS 03.2
05CA: GOTO 5C1
05CB: MOVLW 04
05CC: MOVWF 42
05CD: MOVLW 30
05CE: MOVWF 4C
05CF: CALL 0FE
05D0: DECFSZ 42,F
05D1: GOTO 5CD
05D2: MOVLW 07
05D3: MOVWF 43
05D4: MOVF 43,W
05D5: CALL 0B3
05D6: INCF 43,F
05D7: MOVWF 77
05D8: MOVWF 4C
05D9: CALL 0FE
05DA: MOVLW 10
05DB: SUBWF 43,W
05DC: BTFSS 03.2
05DD: GOTO 5D4
.................... }
.................... else
05DE: GOTO 5EA
.................... printf("Error");
05DF: CLRF 41
05E0: MOVF 41,W
05E1: CALL 0C8
05E2: INCF 41,F
05E3: MOVWF 77
05E4: MOVWF 4C
05E5: CALL 0FE
05E6: MOVLW 05
05E7: SUBWF 41,W
05E8: BTFSS 03.2
05E9: GOTO 5E0
.................... break;
05EA: GOTO 61A
....................
.................... default: // fine ticks number
.................... if (isdigit(string[0]))
05EB: MOVF 32,W
05EC: SUBLW 2F
05ED: BTFSC 03.0
05EE: GOTO 60F
05EF: MOVF 32,W
05F0: SUBLW 39
05F1: BTFSS 03.0
05F2: GOTO 60F
.................... {
.................... ticks=atol(string);
05F3: CLRF 42
05F4: MOVLW 32
05F5: MOVWF 41
05F6: CALL 242
05F7: MOVF 79,W
05F8: MOVWF 3F
05F9: MOVF 78,W
05FA: MOVWF 3E
.................... printf("%Lu ticks", ticks);
05FB: MOVLW 10
05FC: MOVWF 04
05FD: MOVF 3F,W
05FE: MOVWF 44
05FF: MOVF 3E,W
0600: MOVWF 43
0601: CALL 15F
0602: MOVLW 03
0603: MOVWF 41
0604: MOVF 41,W
0605: CALL 0D2
0606: INCF 41,F
0607: MOVWF 77
0608: MOVWF 4C
0609: CALL 0FE
060A: MOVLW 09
060B: SUBWF 41,W
060C: BTFSS 03.2
060D: GOTO 604
.................... }
.................... else
060E: GOTO 61A
.................... printf("Error");
060F: CLRF 41
0610: MOVF 41,W
0611: CALL 0C8
0612: INCF 41,F
0613: MOVWF 77
0614: MOVWF 4C
0615: CALL 0FE
0616: MOVLW 05
0617: SUBWF 41,W
0618: BTFSS 03.2
0619: GOTO 610
.................... };
....................
.................... };
061A: GOTO 3B6
....................
.................... while(true)
.................... {
.................... output_low(PIN_B4);
061B: BSF 03.5
061C: BCF 06.4
061D: BCF 03.5
061E: BCF 06.4
.................... delay_ms(300);
061F: MOVLW 02
0620: MOVWF 41
0621: MOVLW 96
0622: MOVWF 42
0623: CALL 0E6
0624: DECFSZ 41,F
0625: GOTO 621
.................... output_high(PIN_B4);
0626: BSF 03.5
0627: BCF 06.4
0628: BCF 03.5
0629: BSF 06.4
.................... delay_ms(300);
062A: MOVLW 02
062B: MOVWF 41
062C: MOVLW 96
062D: MOVWF 42
062E: CALL 0E6
062F: DECFSZ 41,F
0630: GOTO 62C
.................... }
0631: GOTO 61B
.................... }
....................
0632: GOTO 632
 
Configuration Fuses:
Word 1: 3731 NOWDT PUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT DEBUG CCPB0 NOPROTECT INTRC
Word 2: 3FFC NOFCMEN NOIESO
/programy/C/PIC/hack/hack.PJT
0,0 → 1,56
[PROJECT]
Target=hack.HEX
Development_Mode=
Processor=0x688F
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\Drivers;
Library=
LinkerScript=
 
[Target Data]
FileList=hack.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[hack.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=hack.c
 
[Windows]
0=0000 hack.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\hack\hack.c
2=C:\Program Files\PICC\devices\16F88.h
3=D:\KAKLIK\programy\PIC_C\hack\hack.h
4=C:\Program Files\PICC\Drivers\stdlib.h
5=C:\Program Files\PICC\Drivers\stddef.h
6=C:\Program Files\PICC\Drivers\string.h
7=C:\Program Files\PICC\Drivers\ctype.h
8=
[debugperif]
selected=Analog/Digital Conv
[debugram]
autoread=1
[debugeedata]
autoread=1
[debugbreak]
count=0
[pcwdebug]
watchcol0=75
[debugwatch]
count=0
[debugexpr]
expr=
sideeffects=0
/programy/C/PIC/hack/hack.SYM
0,0 → 1,107
015-016 CCP_1
015 CCP_1_LOW
016 CCP_1_HIGH
020 @INTERRUPT_AREA
021 @INTERRUPT_AREA
022 @INTERRUPT_AREA
023 @INTERRUPT_AREA
024 @INTERRUPT_AREA
025 @INTERRUPT_AREA
026 @INTERRUPT_AREA
027 @INTERRUPT_AREA
028 @INTERRUPT_AREA
029-02A strtok.save
02B-02E _Randseed
02F-030 main.i
031 main.ch
032-03B main.string
03C-03D main.prescale
03E-03F main.ticks
040 main.n
041-042 atol.s
041 @GETCH_1_.@SCRATCH
041 main.@SCRATCH
042 @delay_ms1.P1
042 main.@SCRATCH
043-044 atol.result
043-044 @PRINTF_LU_1200_51_50.P1
043 main.@SCRATCH
044 @PRINTF_U_1200_51_50.P1
045 @PRINTF_U_1200_51_50.P1
045 atol.sign
045 @PRINTF_LU_1200_51_50.@SCRATCH
046 atol.base
046 @DIV88.P1
046 @PRINTF_LU_1200_51_50.@SCRATCH
047 @DIV88.P1
047 atol.index
047 @PRINTF_LU_1200_51_50.@SCRATCH
048 atol.c
048 @PRINTF_LU_1200_51_50.@SCRATCH
048 @DIV88.@SCRATCH
049-04A @MUL1616.P1
049 atol.@SCRATCH
049 @PRINTF_LU_1200_51_50.@SCRATCH
04A atol.@SCRATCH
04A @PRINTF_LU_1200_51_50.@SCRATCH
04B-04C @MUL1616.P1
04B atol.@SCRATCH
04B @PRINTF_LU_1200_51_50.@SCRATCH
04C @PUTCHAR_1_.P1
04D @MUL1616.@SCRATCH
077 @SCRATCH
078 @SCRATCH
078 _RETURN_
079 @SCRATCH
07A @SCRATCH
07B @SCRATCH
09C.6 C1OUT
09C.7 C2OUT
 
00E6 @delay_ms1
00FE @PUTCHAR_1_
012A @GETCH_1_
022C @MUL1616
0242 atol
00E0 TIMER1_isr
00E3 TIMER2_isr
003F @const290
0342 main
004E @const11193
0059 @const11223
015F @PRINTF_LU_1200_51_50
006C @const11259
01C9 @DIV88
01DE @PRINTF_U_1200_51_50
0088 @const11300
009D @const11330
00B3 @const11344
00C8 @const11352
00D2 @const11365
0342 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\hack\hack.c
D:\KAKLIK\programy\PIC_C\hack\hack.h
C:\Program Files\PICC\devices\16F88.h
C:\Program Files\PICC\Drivers\stdlib.h
C:\Program Files\PICC\Drivers\stddef.h
C:\Program Files\PICC\Drivers\string.h
C:\Program Files\PICC\Drivers\ctype.h
 
Compiler Settings:
Processor: PIC16F88
Pointer Size: 16
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
ICD Provisions: Yes
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\hack\hack.err
INHX8: D:\KAKLIK\programy\PIC_C\hack\hack.HEX
Symbols: D:\KAKLIK\programy\PIC_C\hack\hack.SYM
List: D:\KAKLIK\programy\PIC_C\hack\hack.LST
Debug/COFF: D:\KAKLIK\programy\PIC_C\hack\hack.cof
Call Tree: D:\KAKLIK\programy\PIC_C\hack\hack.tre
Statistics: D:\KAKLIK\programy\PIC_C\hack\hack.sta
/programy/C/PIC/hack/hack.c
0,0 → 1,137
#include ".\hack.h"
#include <stdlib.h>
 
#define SYNC PIN_B4 // Spousteni oscyloskopu
#define HACK PIN_B5 // Zkratovani napajeni SmartCard
#define CLOCK PIN_B6 // Hodiny ze SmartCard
 
#int_TIMER1
TIMER1_isr()
{
 
}
 
#int_TIMER2
TIMER2_isr()
{
 
}
 
void main()
{
unsigned int16 i;
char ch;
char string[10];
const char ver[]={"HACK v1.0\0"};
unsigned int16 prescale;
unsigned int16 ticks;
int n;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);
// setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
// enable_interrupts(INT_TIMER1);
// enable_interrupts(INT_TIMER2);
// enable_interrupts(GLOBAL);
 
setup_oscillator(OSC_4MHZ|OSC_INTRC); // 4 MHz interni RC oscilator
 
delay_ms(100);
printf("\n\r\n\r%s", ver);
output_low(SYNC);
output_low(HACK);
ticks=1;
prescale=0;
 
while(true)
{
printf("\n\r>");
n=0;
do
{
ch=getchar();
printf("%c",ch);
string[n++]=ch;
} while((13 != ch) && (n < 10));
string[n]=0;
printf("\n\r");
switch(string[0])
{
case 'g': // GO
printf("%Lue4 + %Lu GO", prescale, ticks);
for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };
set_timer1(0); while ( get_timer1() < ticks ) ;
output_high(SYNC);
delay_ms(1);
output_low(SYNC);
break;
 
case 'r': // REPEAT
n=0;
while(true)
{
printf("%Lue4 + %Lu REPEAT %u\n\r", prescale, ticks, n++);
for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };
set_timer1(0); while ( get_timer1() < ticks ) ;
output_high(SYNC);
delay_ms(20);
output_low(SYNC);
delay_ms(2000);
};
break;
 
case 'h': // HACK
printf("%Lue4 + %Lu HACK", prescale, ticks);
for(i=0; i<prescale; i++) { set_timer1(0); while ( get_timer1() < 10000 ) ; };
set_timer1(0); while ( get_timer1() < ticks ) ;
output_high(SYNC);
output_low(CLOCK);
delay_ms(10);
output_high(HACK);
delay_ms(10000);
output_low(HACK);
output_low(SYNC);
input(CLOCK);
break;
 
case 'i': // Info
printf("%s\n\r", ver);
printf("%Lue4 + %Lu ticks", prescale, ticks);
break;
 
case 'p':
if (isdigit(string[1]))
{
prescale=atol(string+1);
printf("%Lu x 10000 prescale", prescale);
}
else
printf("Error");
break;
 
default: // fine ticks number
if (isdigit(string[0]))
{
ticks=atol(string);
printf("%Lu ticks", ticks);
}
else
printf("Error");
};
 
};
 
while(true)
{
output_low(PIN_B4);
delay_ms(300);
output_high(PIN_B4);
delay_ms(300);
}
}
/programy/C/PIC/hack/hack.cof
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
/programy/C/PIC/hack/hack.err
0,0 → 1,0
No Errors
/programy/C/PIC/hack/hack.h
0,0 → 1,11
#include <16F88.h>
#device *=16
#device ICD=TRUE
#device adc=8
#fuses NOWDT,INTRC , NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO
//#fuses NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO
#use delay(clock=4000000,RESTART_WDT)
//#use rs232(baud=2400,xmit=PIN_B3)
//#use rs232(DEBUGGER)
#use rs232(baud=1200,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8)
 
/programy/C/PIC/hack/hack.sta
0,0 → 1,52
 
ROM used: 1587 (41%)
1587 (41%) including unused fragments
 
1 Average locations per line
3 Average locations per statement
 
RAM used: 41 (11%) at main() level
51 (14%) worst case
 
Lines Stmts % Files
----- ----- --- -----
138 101 18 D:\KAKLIK\programy\PIC_C\hack\hack.c
12 0 0 D:\KAKLIK\programy\PIC_C\hack\hack.h
275 0 0 C:\Program Files\PICC\devices\16F88.h
758 324 50 C:\Program Files\PICC\Drivers\stdlib.h
28 0 0 C:\Program Files\PICC\Drivers\stddef.h
417 126 13 C:\Program Files\PICC\Drivers\string.h
28 0 0 C:\Program Files\PICC\Drivers\ctype.h
----- -----
3312 1102 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 24 2 1 @delay_ms1
0 44 3 1 @PUTCHAR_1_
0 53 3 1 @GETCH_1_
0 22 1 5 @MUL1616
0 256 16 11 atol
0 3 0 0 TIMER1_isr
0 3 0 0 TIMER2_isr
0 15 1 0 @const290
0 753 47 21 main
0 11 1 0 @const11193
0 19 1 0 @const11223
0 106 7 9 @PRINTF_LU_1200_51_50
0 28 2 0 @const11259
0 21 1 3 @DIV88
0 78 5 2 @PRINTF_U_1200_51_50
0 21 1 0 @const11300
0 22 1 0 @const11330
0 21 1 0 @const11344
0 10 1 0 @const11352
0 14 1 0 @const11365
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-0003E 59 0
0003F-007FF 1524 461
00800-00EFF 0 1792
 
/programy/C/PIC/hack/hack.tre
0,0 → 1,100
ÀÄhack
ÃÄmain 0/753 Ram=21
³ ÃÄ??0??
³ ÃÄ@delay_ms1 0/24 Ram=1
³ ÃÄ@const11193 0/11 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const290 0/15 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@GETCH_1_ 0/53 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11223 0/19 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@delay_ms1 0/24 Ram=1
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11259 0/28 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11259 0/28 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PRINTF_U_1200_51_50 0/78 Ram=2
³ ³ ÃÄ@DIV88 0/21 Ram=3
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÃÄ@DIV88 0/21 Ram=3
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@delay_ms1 0/24 Ram=1
³ ÃÄ@delay_ms1 0/24 Ram=1
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11300 0/21 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11300 0/21 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@delay_ms1 0/24 Ram=1
³ ÃÄ@delay_ms1 0/24 Ram=1
³ ÃÄ@const290 0/15 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11330 0/22 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11330 0/22 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄatol 0/256 Ram=11
³ ³ ÀÄ@MUL1616 0/22 Ram=5
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11344 0/21 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11344 0/21 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11352 0/10 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄatol 0/256 Ram=11
³ ³ ÀÄ@MUL1616 0/22 Ram=5
³ ÃÄ@PRINTF_LU_1200_51_50 0/106 Ram=9
³ ³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ³ ÀÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11365 0/14 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@const11352 0/10 Ram=0
³ ÃÄ@PUTCHAR_1_ 0/44 Ram=1
³ ÃÄ@delay_ms1 0/24 Ram=1
³ ÀÄ@delay_ms1 0/24 Ram=1
ÃÄTIMER1_isr 0/3 Ram=0
ÀÄTIMER2_isr 0/3 Ram=0
/programy/C/PIC/motory/DC/regulator_letadlo/main.BAK
0,0 → 1,14
#include "D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h"
 
 
void main()
{
while (true)
{
 
output_high(pin_A1);
Delay_us(50);
output_low(pin_A1);
Delay_us(500);
}
}
/programy/C/PIC/motory/DC/regulator_letadlo/main.HEX
0,0 → 1,7
:1000000000308A000428000084011F308305831615
:1000100085108312851403308C008C0B0D288316F9
:1000200085108312851031308C008C0B1528000050
:0600300000000728630038
:02400E00F93F78
:00000001FF
;PIC16F84
/programy/C/PIC/motory/DC/regulator_letadlo/main.LST
0,0 → 1,62
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\motory\dc\regulator_letadlo\main.LST
 
ROM used: 27 (3%)
Largest free fragment is 997
RAM used: 2 (3%) at main() level
2 (3%) worst case
Stack: 0 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 004
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
.................... #fuses XT,NOWDT
....................
....................
....................
....................
.................... void main()
.................... {
0004: CLRF 04
0005: MOVLW 1F
0006: ANDWF 03,F
.................... while (true)
.................... {
....................
.................... output_high(pin_A1);
0007: BSF 03.5
0008: BCF 05.1
0009: BCF 03.5
000A: BSF 05.1
.................... Delay_us(10);
000B: MOVLW 03
000C: MOVWF 0C
000D: DECFSZ 0C,F
000E: GOTO 00D
.................... output_low(pin_A1);
000F: BSF 03.5
0010: BCF 05.1
0011: BCF 03.5
0012: BCF 05.1
.................... Delay_us(150);
0013: MOVLW 31
0014: MOVWF 0C
0015: DECFSZ 0C,F
0016: GOTO 015
0017: NOP
0018: NOP
.................... }
0019: GOTO 007
.................... }
....................
001A: SLEEP
/programy/C/PIC/motory/DC/regulator_letadlo/main.PJT
0,0 → 1,32
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
/programy/C/PIC/motory/DC/regulator_letadlo/main.SYM
0,0 → 1,12
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
delay_ms.P1
delay_us.P2
 
0004 main
 
Project Files:
d:\@kaklik\programy\pic_c\motory\dc\regulator_letadlo\main.c
D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h
C:\PROGRAM FILES\PICC\devices\16F84.h
/programy/C/PIC/motory/DC/regulator_letadlo/main.c
0,0 → 1,14
#include "D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h"
 
 
void main()
{
while (true)
{
 
output_high(pin_A1);
Delay_us(10);
output_low(pin_A1);
Delay_us(150);
}
}
/programy/C/PIC/motory/DC/regulator_letadlo/main.cod
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
/programy/C/PIC/motory/DC/regulator_letadlo/main.err
0,0 → 1,0
No Errors
/programy/C/PIC/motory/DC/regulator_letadlo/main.h
0,0 → 1,4
#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,NOWDT
 
/programy/C/PIC/motory/DC/regulator_letadlo/main.sta
0,0 → 1,27
 
ROM used: 27 (3%)
997 (97%) including unused fragments
 
0 Average locations per line
4 Average locations per statement
 
RAM used: 2 (3%) at main() level
2 (3%) worst case
 
Lines Stmts % Files
----- ----- --- -----
15 6 100 d:\@kaklik\programy\pic_c\motory\dc\regulator_letadlo\main.c
5 0 0 D:\@Kaklik\programy\PIC_C\motory\DC\regulator_letadlo\main.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h
----- -----
262 12 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 23 85 0 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 23 997
 
/programy/C/PIC/motory/DC/regulator_letadlo/main.tre
0,0 → 1,3
ÀÄmain
ÀÄmain 0/23 Ram=0
ÀÄ??0??
/programy/C/PIC/motory/DC/regulator_letadlo/prg.bat
0,0 → 1,6
call picpgr stop
call picpgr erase pic16f84
call picpgr program main.hex hex pic16f84
call picpgr run
pause
call picpgr stop
/programy/C/PIC/motory/DC/regulator_letadlo/vssver.scc
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
/programy/C/PIC/motory/hodinovy/Run.BAT
0,0 → 1,8
@echo off
:loop
picpgr reset PIC16F84
picpgr run
pause
picpgr stop
pause
goto loop
/programy/C/PIC/motory/hodinovy/main.BAK
0,0 → 1,22
#include "D:\@Kaklik\programy\PIC_C\motory\main.h"
 
 
void main()
{
while (true)
{
 
Delay_ms(15);
output_high(pin_A0);
output_low(pin_A1);
// output_high(pin_A2);
// Delay_ms(10);
// output_low(pin_A2);
Delay_ms(15);
output_low(pin_A0);
output_high(pin_A1);
}
}
/programy/C/PIC/motory/hodinovy/main.HEX
0,0 → 1,10
:1000000000308A00192800000F308400000803190E
:10001000182801308D008C018C0B0C288D0B0B28BF
:100020004A308C008C0B122800000000800B09283D
:10003000003484011F30830519308F00042083169B
:10004000051083120514831685108312851019304C
:100050008F00042083160510831205108316851067
:08006000831285141C286300C3
:02400E00FD3F74
:00000001FF
;PIC16F84
/programy/C/PIC/motory/hodinovy/main.LST
0,0 → 1,95
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\motory\main.LST
 
ROM used: 52 (5%)
Largest free fragment is 972
RAM used: 2 (3%) at main() level
3 (4%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 019
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\motory\main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 0F
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: RETLW 00
.................... #fuses XT,WDT
....................
....................
....................
....................
.................... void main()
.................... {
0019: CLRF 04
001A: MOVLW 1F
001B: ANDWF 03,F
.................... while (true)
.................... {
....................
.................... Delay_ms(25);
001C: MOVLW 19
001D: MOVWF 0F
001E: CALL 004
....................
.................... output_high(pin_A0);
001F: BSF 03.5
0020: BCF 05.0
0021: BCF 03.5
0022: BSF 05.0
.................... output_low(pin_A1);
0023: BSF 03.5
0024: BCF 05.1
0025: BCF 03.5
0026: BCF 05.1
....................
.................... // output_high(pin_A2);
.................... // Delay_ms(10);
.................... // output_low(pin_A2);
.................... Delay_ms(25);
0027: MOVLW 19
0028: MOVWF 0F
0029: CALL 004
....................
.................... output_low(pin_A0);
002A: BSF 03.5
002B: BCF 05.0
002C: BCF 03.5
002D: BCF 05.0
.................... output_high(pin_A1);
002E: BSF 03.5
002F: BCF 05.1
0030: BCF 03.5
0031: BSF 05.1
.................... }
0032: GOTO 01C
.................... }
....................
0033: SLEEP
/programy/C/PIC/motory/hodinovy/main.PJT
0,0 → 1,32
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
/programy/C/PIC/motory/hodinovy/main.SYM
0,0 → 1,14
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F delay_ms.P1
delay_us.P1
 
0004 delay_ms
0019 main
0040 @cinit
 
Project Files:
d:\@kaklik\programy\pic_c\motory\main.c
D:\@Kaklik\programy\PIC_C\motory\main.h
C:\PROGRAM FILES\PICC\devices\16F84.h
/programy/C/PIC/motory/hodinovy/main.c
0,0 → 1,22
#include "D:\@Kaklik\programy\PIC_C\motory\main.h"
 
 
void main()
{
while (true)
{
 
Delay_ms(25);
output_high(pin_A0);
output_low(pin_A1);
// output_high(pin_A2);
// Delay_ms(10);
// output_low(pin_A2);
Delay_ms(25);
output_low(pin_A0);
output_high(pin_A1);
}
}
/programy/C/PIC/motory/hodinovy/main.cod
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
/programy/C/PIC/motory/hodinovy/main.err
0,0 → 1,0
No Errors
/programy/C/PIC/motory/hodinovy/main.h
0,0 → 1,4
#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,WDT
 
/programy/C/PIC/motory/hodinovy/main.sta
0,0 → 1,28
 
ROM used: 52 (5%)
972 (95%) including unused fragments
 
0 Average locations per line
6 Average locations per statement
 
RAM used: 2 (3%) at main() level
3 (4%) worst case
 
Lines Stmts % Files
----- ----- --- -----
23 8 100 d:\@kaklik\programy\pic_c\motory\main.c
5 0 0 D:\@Kaklik\programy\PIC_C\motory\main.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h
----- -----
278 16 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 40 1 delay_ms
0 27 52 0 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 48 972
 
/programy/C/PIC/motory/hodinovy/main.tre
0,0 → 1,5
ÀÄmain
ÀÄmain 0/27 Ram=0
ÃÄ??0??
ÃÄdelay_ms 0/21 Ram=1
ÀÄdelay_ms 0/21 Ram=1
/programy/C/PIC/motory/hodinovy/prg.bat
0,0 → 1,6
call picpgr stop
call picpgr erase pic16f84
call picpgr program main.hex hex pic16f84
call picpgr run
pause
call picpgr stop
/programy/C/PIC/motory/hodinovy/vssver.scc
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
/programy/C/PIC/motory/krokac/A.BAT
0,0 → 1,3
call picpgr erase pic16f88
call picpgr program krokac.hex hex pic16f88
call picpgr run
/programy/C/PIC/motory/krokac/KROKAC.C
0,0 → 1,139
#include "C:\MIHO_DAT\KROKAC\krokac.h"
 
 
unsigned int StepState; // Vnitrni promenna kroku
signed int StepDirection; // Smer +1/0/-1
 
byte const StepTab[8]={ // Tabulka pro krokovy motor
0b0001, // 0
0b0101, // 1
0b0100, // 2
0b0110, // 3
0b0010, // 4
0b1010, // 5
0b1000 // 6
0b1001, // 7
};
#INT_TIMER2
void StepNext()
{
unsigned int i;
StepState+=StepDirection; // posun se na dalsi krok
i=StepState&0b111; // vezmi spodni 3 bity stavu
i=StepTab[i]; // prekoduj pomoci tabulky
output_bit(MOTORA,i&0b0001); // aktivuj jednotlive vystupy
output_bit(MOTORB,i&0b0010);
output_bit(MOTORC,i&0b0100);
output_bit(MOTORD,i&0b1000);
}
 
 
void StepSetDirection(signed int Direction)
{
if(Direction> 1) Direction= 1;
if(Direction<-1) Direction=-1;
StepDirection=Direction;
}
 
 
void StepSetTime(unsigned int16 Time)
{
}
 
void Delay(unsigned int16 Time)
{
while(Time>255) {Time-=256;delay_us(256);};
if(Time!=0) delay_us(Time);
}
 
 
void main()
{
unsigned int16 T;
unsigned long int i;
 
// Nastav pracovni frekvenci procesoru
setup_oscillator(OSC_4MHZ);
 
// Vypni motorovy vystup
output_low(MOTORA);
output_low(MOTORB);
output_low(MOTORC);
output_low(MOTORD);
 
// Vstupy s pull-up odporem
port_b_pullups(TRUE);
 
// Inicializace A/D prevodniku
setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_INTERNAL);
set_adc_channel(0);
 
// Dalsi inicializace
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
 
// Inicializace stavovych promennych
StepState=0;
 
// Nastaveni casovace
setup_timer_2(T2_DIV_BY_16,0xFF,1);
 
// Nastveni preruseni od casovace
enable_interrupts(global);
enable_interrupts(int_timer2);
for(;;)
{
 
T=read_adc(ADC_READ_ONLY); // Prectu hodnotu
read_adc(ADC_START_ONLY); // Ostartuji dalsi prevod (na pozadi)
 
//setup_timer_2(T2_DIV_BY_16,T,1);
if(T>0) *0x92=T; // Preload register casovace
 
// Podle prepinacu se hybu
if(input(PIN_B5))
{
if(input(PIN_B4)) StepSetDirection(1); else StepSetDirection(-1);
}
else
{ int1 x; // pomocna promenna aby se volalo spozdeni jen 1x
if (StepState>230) {
if (!input(PIN_B4) && (x))
{
StepSetDirection(0);
delay_ms(500);
x=0;
};
StepSetDirection(-1);
}
if (StepState<30) {
StepSetDirection( 1);
x=1;
}
}
//StepDirection=2;
//for(i=0;i<800;i++)
//{
// StepNext();
// Delay(T);
//}
//delay_ms(10);
//StepDirection=-1;
//for(i=0;i<800;i++)
//{
// StepNext();
// Delay(T);
//}
//delay_ms(10);
 
} // Cyklus for
}
/programy/C/PIC/motory/krokac/KROKAC.H
0,0 → 1,23
#include <16F88.h>
//#device ICD=TRUE
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES RC //Resistor/Capacitor Osc with CLKOUT
#FUSES NOPUT //No Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
//#FUSES DEBUG //Debug mode for use with ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES IESO //Internal External Switch Over mode enabled
 
#use delay(clock=4000000)
#define MOTORA PIN_B0
#define MOTORB PIN_B1
#define MOTORC PIN_B2
#define MOTORD PIN_B3
 
/programy/C/PIC/motory/krokac/KROKAC.HEX
0,0 → 1,44
:1000000000308A0098280000FF00030E8301A10041
:100010007F08A0000A08A8008A01A00E0408A20018
:100020007708A3007808A4007908A5007A08A6003C
:100030007B08A700831383128C308400801C222845
:100040008C183528220884002308F7002408F800BB
:100050002508F9002608FA002708FB0028088A006E
:10006000210E8300FF0E7F0E09008A1143280A101B
:100070008A100A118207013405340434063402342C
:100080000A34083409342A082907A900290807393D
:10009000B20032083720F800B2003218512806109A
:1000A00052280614831606108312B2185928861097
:1000B0005A28861483168610831232196128061175
:1000C00062280615831606118312B2196928861153
:1000D0006A2886158316861183128C108A112228AD
:1000E000B01B78283008013C031878280130B00094
:1000F0003008803A7E3C031C7F28FF30B000300877
:10010000AA00003431308400000803199628013019
:10011000F800F701F70B8A28F80B89284A30F70016
:10012000F70B902800000000800B87288A113029E7
:1001300084011F30830583161F129F121B0880390C
:100140009B0007309C001C0883120D13603083163F
:100150008F000610831206108316861083128610F5
:1001600083160611831206118316861183128611D7
:10017000831681131F129F121B08803901389B00C0
:100180001F1383121F179F1783169F1383121F14A9
:100190000030F8001F08C73978049F0094128316B6
:1001A0000611861406120030831294008316940000
:1001B0000108C7390838810083129001073083167F
:1001C0009C0005080330F700F70BE4281C08831295
:1001D0000D1383169D018312A9010030F800063823
:1001E0009200FF3083169200C03083128B04831676
:1001F0008C1483121F1DFE288316F9281E08AC01DB
:10020000AB001F15AB08031D0829AC0803190C2906
:100210002B08831692008312831686168312861E7D
:100220001E29831606168312061E1A290130B000F5
:1002300070201D29FF30B00070203E292908E63CBF
:1002400003183629831606168312061A33292F1C23
:100250003329B00170200230B000FA30B10082289A
:10026000B00B2D292F10FF30B000702029081D3C45
:10027000031C3E290130B00070202F148316F9288A
:02028000630019
:04400E003B3FFF3FF6
:00000001FF
;PIC16F88
/programy/C/PIC/motory/krokac/KROKAC.LST
0,0 → 1,495
CCS PCM C Compiler, Version 3.234, 27853 16-X-05 21:12
 
Filename: C:\MIHO_DAT\KROKAC\krokac.LST
 
ROM used: 321 words (8%)
Largest free fragment is 2048
RAM used: 21 (12%) at main() level
24 (14%) worst case
Stack: 3 worst case (1 in main + 2 for interrupts)
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 098
0003: NOP
0004: MOVWF 7F
0005: SWAPF 03,W
0006: CLRF 03
0007: MOVWF 21
0008: MOVF 7F,W
0009: MOVWF 20
000A: MOVF 0A,W
000B: MOVWF 28
000C: CLRF 0A
000D: SWAPF 20,F
000E: MOVF 04,W
000F: MOVWF 22
0010: MOVF 77,W
0011: MOVWF 23
0012: MOVF 78,W
0013: MOVWF 24
0014: MOVF 79,W
0015: MOVWF 25
0016: MOVF 7A,W
0017: MOVWF 26
0018: MOVF 7B,W
0019: MOVWF 27
001A: BCF 03.7
001B: BCF 03.5
001C: MOVLW 8C
001D: MOVWF 04
001E: BTFSS 00.1
001F: GOTO 022
0020: BTFSC 0C.1
0021: GOTO 035
0022: MOVF 22,W
0023: MOVWF 04
0024: MOVF 23,W
0025: MOVWF 77
0026: MOVF 24,W
0027: MOVWF 78
0028: MOVF 25,W
0029: MOVWF 79
002A: MOVF 26,W
002B: MOVWF 7A
002C: MOVF 27,W
002D: MOVWF 7B
002E: MOVF 28,W
002F: MOVWF 0A
0030: SWAPF 21,W
0031: MOVWF 03
0032: SWAPF 7F,F
0033: SWAPF 7F,W
0034: RETFIE
0035: BCF 0A.3
0036: GOTO 043
.................... #include "C:\MIHO_DAT\KROKAC\krokac.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... //#device ICD=TRUE
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES RC //Resistor/Capacitor Osc with CLKOUT
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES MCLR //Master Clear pin enabled
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
.................... //#FUSES DEBUG //Debug mode for use with ICD
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES FCMEN //Fail-safe clock monitor enabled
.................... #FUSES IESO //Internal External Switch Over mode enabled
....................
.................... #use delay(clock=4000000)
*
0082: MOVLW 31
0083: MOVWF 04
0084: MOVF 00,W
0085: BTFSC 03.2
0086: GOTO 096
0087: MOVLW 01
0088: MOVWF 78
0089: CLRF 77
008A: DECFSZ 77,F
008B: GOTO 08A
008C: DECFSZ 78,F
008D: GOTO 089
008E: MOVLW 4A
008F: MOVWF 77
0090: DECFSZ 77,F
0091: GOTO 090
0092: NOP
0093: NOP
0094: DECFSZ 00,F
0095: GOTO 087
0096: BCF 0A.3
0097: GOTO 130 (RETURN)
.................... #define MOTORA PIN_B0
.................... #define MOTORB PIN_B1
.................... #define MOTORC PIN_B2
.................... #define MOTORD PIN_B3
....................
....................
....................
....................
.................... unsigned int StepState; // Vnitrni promenna kroku
.................... signed int StepDirection; // Smer +1/0/-1
....................
.................... byte const StepTab[8]={ // Tabulka pro krokovy motor
.................... 0b0001, // 0
.................... 0b0101, // 1
.................... 0b0100, // 2
.................... 0b0110, // 3
.................... 0b0010, // 4
.................... 0b1010, // 5
.................... 0b1000 // 6
.................... 0b1001, // 7
.................... };
....................
.................... #INT_TIMER2
.................... void StepNext()
.................... {
.................... unsigned int i;
....................
.................... StepState+=StepDirection; // posun se na dalsi krok
*
0043: MOVF 2A,W
0044: ADDWF 29,W
0045: MOVWF 29
.................... i=StepState&0b111; // vezmi spodni 3 bity stavu
0046: MOVF 29,W
0047: ANDLW 07
0048: MOVWF 32
.................... i=StepTab[i]; // prekoduj pomoci tabulky
0049: MOVF 32,W
004A: CALL 037
004B: MOVWF 78
004C: MOVWF 32
.................... output_bit(MOTORA,i&0b0001); // aktivuj jednotlive vystupy
004D: BTFSC 32.0
004E: GOTO 051
004F: BCF 06.0
0050: GOTO 052
0051: BSF 06.0
0052: BSF 03.5
0053: BCF 06.0
.................... output_bit(MOTORB,i&0b0010);
0054: BCF 03.5
0055: BTFSC 32.1
0056: GOTO 059
0057: BCF 06.1
0058: GOTO 05A
0059: BSF 06.1
005A: BSF 03.5
005B: BCF 06.1
.................... output_bit(MOTORC,i&0b0100);
005C: BCF 03.5
005D: BTFSC 32.2
005E: GOTO 061
005F: BCF 06.2
0060: GOTO 062
0061: BSF 06.2
0062: BSF 03.5
0063: BCF 06.2
.................... output_bit(MOTORD,i&0b1000);
0064: BCF 03.5
0065: BTFSC 32.3
0066: GOTO 069
0067: BCF 06.3
0068: GOTO 06A
0069: BSF 06.3
006A: BSF 03.5
006B: BCF 06.3
.................... }
....................
....................
006C: BCF 03.5
006D: BCF 0C.1
006E: BCF 0A.3
006F: GOTO 022
.................... void StepSetDirection(signed int Direction)
.................... {
.................... if(Direction> 1) Direction= 1;
0070: BTFSC 30.7
0071: GOTO 078
0072: MOVF 30,W
0073: SUBLW 01
0074: BTFSC 03.0
0075: GOTO 078
0076: MOVLW 01
0077: MOVWF 30
.................... if(Direction<-1) Direction=-1;
0078: MOVF 30,W
0079: XORLW 80
007A: SUBLW 7E
007B: BTFSS 03.0
007C: GOTO 07F
007D: MOVLW FF
007E: MOVWF 30
.................... StepDirection=Direction;
007F: MOVF 30,W
0080: MOVWF 2A
.................... }
0081: RETLW 00
....................
....................
.................... void StepSetTime(unsigned int16 Time)
.................... {
....................
.................... }
....................
.................... void Delay(unsigned int16 Time)
.................... {
.................... while(Time>255) {Time-=256;delay_us(256);};
.................... if(Time!=0) delay_us(Time);
.................... }
....................
....................
.................... void main()
.................... {
*
0098: CLRF 04
0099: MOVLW 1F
009A: ANDWF 03,F
009B: BSF 03.5
009C: BCF 1F.4
009D: BCF 1F.5
009E: MOVF 1B,W
009F: ANDLW 80
00A0: MOVWF 1B
00A1: MOVLW 07
00A2: MOVWF 1C
00A3: MOVF 1C,W
00A4: BCF 03.5
00A5: BCF 0D.6
.................... unsigned int16 T;
.................... unsigned long int i;
....................
.................... // Nastav pracovni frekvenci procesoru
.................... setup_oscillator(OSC_4MHZ);
00A6: MOVLW 60
00A7: BSF 03.5
00A8: MOVWF 0F
....................
.................... // Vypni motorovy vystup
.................... output_low(MOTORA);
00A9: BCF 06.0
00AA: BCF 03.5
00AB: BCF 06.0
.................... output_low(MOTORB);
00AC: BSF 03.5
00AD: BCF 06.1
00AE: BCF 03.5
00AF: BCF 06.1
.................... output_low(MOTORC);
00B0: BSF 03.5
00B1: BCF 06.2
00B2: BCF 03.5
00B3: BCF 06.2
.................... output_low(MOTORD);
00B4: BSF 03.5
00B5: BCF 06.3
00B6: BCF 03.5
00B7: BCF 06.3
....................
.................... // Vstupy s pull-up odporem
.................... port_b_pullups(TRUE);
00B8: BSF 03.5
00B9: BCF 01.7
....................
.................... // Inicializace A/D prevodniku
.................... setup_adc_ports(sAN0|VSS_VDD);
00BA: BCF 1F.4
00BB: BCF 1F.5
00BC: MOVF 1B,W
00BD: ANDLW 80
00BE: IORLW 01
00BF: MOVWF 1B
.................... setup_adc(ADC_CLOCK_INTERNAL);
00C0: BCF 1F.6
00C1: BCF 03.5
00C2: BSF 1F.6
00C3: BSF 1F.7
00C4: BSF 03.5
00C5: BCF 1F.7
00C6: BCF 03.5
00C7: BSF 1F.0
.................... set_adc_channel(0);
00C8: MOVLW 00
00C9: MOVWF 78
00CA: MOVF 1F,W
00CB: ANDLW C7
00CC: IORWF 78,W
00CD: MOVWF 1F
....................
.................... // Dalsi inicializace
.................... setup_spi(FALSE);
00CE: BCF 14.5
00CF: BSF 03.5
00D0: BCF 06.2
00D1: BSF 06.1
00D2: BCF 06.4
00D3: MOVLW 00
00D4: BCF 03.5
00D5: MOVWF 14
00D6: BSF 03.5
00D7: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
00D8: MOVF 01,W
00D9: ANDLW C7
00DA: IORLW 08
00DB: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
00DC: BCF 03.5
00DD: CLRF 10
.................... setup_comparator(NC_NC_NC_NC);
00DE: MOVLW 07
00DF: BSF 03.5
00E0: MOVWF 1C
00E1: MOVF 05,W
00E2: MOVLW 03
00E3: MOVWF 77
00E4: DECFSZ 77,F
00E5: GOTO 0E4
00E6: MOVF 1C,W
00E7: BCF 03.5
00E8: BCF 0D.6
.................... setup_vref(FALSE);
00E9: BSF 03.5
00EA: CLRF 1D
....................
.................... // Inicializace stavovych promennych
.................... StepState=0;
00EB: BCF 03.5
00EC: CLRF 29
....................
.................... // Nastaveni casovace
.................... setup_timer_2(T2_DIV_BY_16,0xFF,1);
00ED: MOVLW 00
00EE: MOVWF 78
00EF: IORLW 06
00F0: MOVWF 12
00F1: MOVLW FF
00F2: BSF 03.5
00F3: MOVWF 12
....................
.................... // Nastveni preruseni od casovace
.................... enable_interrupts(global);
00F4: MOVLW C0
00F5: BCF 03.5
00F6: IORWF 0B,F
.................... enable_interrupts(int_timer2);
00F7: BSF 03.5
00F8: BSF 0C.1
....................
.................... for(;;)
.................... {
....................
.................... T=read_adc(ADC_READ_ONLY); // Prectu hodnotu
00F9: BCF 03.5
00FA: BTFSS 1F.2
00FB: GOTO 0FE
00FC: BSF 03.5
00FD: GOTO 0F9
00FE: MOVF 1E,W
00FF: CLRF 2C
0100: MOVWF 2B
.................... read_adc(ADC_START_ONLY); // Ostartuji dalsi prevod (na pozadi)
0101: BSF 1F.2
....................
.................... //setup_timer_2(T2_DIV_BY_16,T,1);
.................... if(T>0) *0x92=T; // Preload register casovace
0102: MOVF 2B,F
0103: BTFSS 03.2
0104: GOTO 108
0105: MOVF 2C,F
0106: BTFSC 03.2
0107: GOTO 10C
0108: MOVF 2B,W
0109: BSF 03.5
010A: MOVWF 12
010B: BCF 03.5
....................
.................... // Podle prepinacu se hybu
.................... if(input(PIN_B5))
010C: BSF 03.5
010D: BSF 06.5
010E: BCF 03.5
010F: BTFSS 06.5
0110: GOTO 11E
.................... {
.................... if(input(PIN_B4)) StepSetDirection(1); else StepSetDirection(-1);
0111: BSF 03.5
0112: BSF 06.4
0113: BCF 03.5
0114: BTFSS 06.4
0115: GOTO 11A
0116: MOVLW 01
0117: MOVWF 30
0118: CALL 070
0119: GOTO 11D
011A: MOVLW FF
011B: MOVWF 30
011C: CALL 070
.................... }
.................... else
011D: GOTO 13E
.................... { int1 x; // pomocna promenna aby se volalo spozdeni jen 1x
.................... if (StepState>230) {
011E: MOVF 29,W
011F: SUBLW E6
0120: BTFSC 03.0
0121: GOTO 136
.................... if (!input(PIN_B4) && (x))
0122: BSF 03.5
0123: BSF 06.4
0124: BCF 03.5
0125: BTFSC 06.4
0126: GOTO 133
0127: BTFSS 2F.0
0128: GOTO 133
.................... {
.................... StepSetDirection(0);
0129: CLRF 30
012A: CALL 070
.................... delay_ms(500);
012B: MOVLW 02
012C: MOVWF 30
012D: MOVLW FA
012E: MOVWF 31
012F: GOTO 082
0130: DECFSZ 30,F
0131: GOTO 12D
.................... x=0;
0132: BCF 2F.0
.................... };
.................... StepSetDirection(-1);
0133: MOVLW FF
0134: MOVWF 30
0135: CALL 070
.................... }
.................... if (StepState<30) {
0136: MOVF 29,W
0137: SUBLW 1D
0138: BTFSS 03.0
0139: GOTO 13E
.................... StepSetDirection( 1);
013A: MOVLW 01
013B: MOVWF 30
013C: CALL 070
.................... x=1;
013D: BSF 2F.0
.................... }
.................... }
.................... //StepDirection=2;
.................... //for(i=0;i<800;i++)
.................... //{
.................... // StepNext();
.................... // Delay(T);
.................... //}
.................... //delay_ms(10);
.................... //StepDirection=-1;
.................... //for(i=0;i<800;i++)
.................... //{
.................... // StepNext();
.................... // Delay(T);
.................... //}
.................... //delay_ms(10);
....................
.................... } // Cyklus for
013E: BSF 03.5
013F: GOTO 0F9
....................
.................... }
....................
0140: SLEEP
 
Configuration Fuses:
Word 1: 3F3B NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT RC
Word 2: 3FFF FCMEN IESO
/programy/C/PIC/motory/krokac/KROKAC.PJT
0,0 → 1,39
[PROJECT]
Target=krokac.HEX
Development_Mode=
Processor=0x688F
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC_3_234\devices\;C:\PROGRAM FILES\P
Library=
LinkerScript=
 
[Target Data]
FileList=krokac.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[krokac.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=krokac.c
 
[Windows]
0=0000 krokac.c 0 0 796 451 3 0
 
[Opened Files]
1=C:\MIHO_DAT\KROKAC\krokac.c
2=C:\MIHO_DAT\KROKAC\krokac.h
3=C:\PROGRAM FILES\PICC_3_234\devices\16F88.h
4=C:\MIHO_DAT\KROKAC\krokac.lst
5=
 
/programy/C/PIC/motory/menice/Run.BAT
0,0 → 1,8
@echo off
:loop
picpgr reset PIC16F84
picpgr run
pause
picpgr stop
pause
goto loop
/programy/C/PIC/motory/menice/main.BAK
0,0 → 1,21
#include "D:\@Kaklik\programy\PIC_C\motory\menice\main.h"
 
#DEFINE L1 pin_A0
#DEFINE L2 pin_A1
 
void main()
{
output_low(L1);
output_low(L2);
while(true)
{
output_high(L1);
output_low(L2);
Delay_ms(16);
output_low(L1);
output_high(L2);
Delay_ms(16);
}
}
/programy/C/PIC/motory/menice/main.HEX
0,0 → 1,11
:1000000000308A00192800000F308400000803190E
:10001000182801308D008C018C0B0C288D0B0B28BF
:100020004A308C008C0B122800000000800B09283D
:10003000003484011F3083058316051083120510D8
:100040008316851083128510831685108312851000
:10005000831605108312051411308F0004208316B7
:100060000510831205108316851083128514113034
:080070008F0004202428630026
:02400E00FE3F73
:00000001FF
;PIC16F84
/programy/C/PIC/motory/menice/main.LST
0,0 → 1,102
CCS PCW C Compiler, Version 3.110, 15448
 
Filename: d:\@kaklik\programy\pic_c\motory\menice\main.LST
 
ROM used: 60 (6%)
Largest free fragment is 964
RAM used: 2 (3%) at main() level
3 (4%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 019
0003: NOP
.................... #include "D:\@Kaklik\programy\PIC_C\motory\menice\main.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #use delay(clock=4000000)
0004: MOVLW 0F
0005: MOVWF 04
0006: MOVF 00,W
0007: BTFSC 03.2
0008: GOTO 018
0009: MOVLW 01
000A: MOVWF 0D
000B: CLRF 0C
000C: DECFSZ 0C,F
000D: GOTO 00C
000E: DECFSZ 0D,F
000F: GOTO 00B
0010: MOVLW 4A
0011: MOVWF 0C
0012: DECFSZ 0C,F
0013: GOTO 012
0014: NOP
0015: NOP
0016: DECFSZ 00,F
0017: GOTO 009
0018: RETLW 00
.................... #fuses HS,WDT
....................
....................
....................
.................... #DEFINE L1 pin_A0
.................... #DEFINE L2 pin_A1
....................
.................... void main()
.................... {
0019: CLRF 04
001A: MOVLW 1F
001B: ANDWF 03,F
.................... output_low(L1);
001C: BSF 03.5
001D: BCF 05.0
001E: BCF 03.5
001F: BCF 05.0
.................... output_low(L2);
0020: BSF 03.5
0021: BCF 05.1
0022: BCF 03.5
0023: BCF 05.1
....................
.................... while(true)
.................... {
.................... output_low(L2);
0024: BSF 03.5
0025: BCF 05.1
0026: BCF 03.5
0027: BCF 05.1
.................... output_high(L1);
0028: BSF 03.5
0029: BCF 05.0
002A: BCF 03.5
002B: BSF 05.0
.................... Delay_ms(17);
002C: MOVLW 11
002D: MOVWF 0F
002E: CALL 004
.................... output_low(L1);
002F: BSF 03.5
0030: BCF 05.0
0031: BCF 03.5
0032: BCF 05.0
.................... output_high(L2);
0033: BSF 03.5
0034: BCF 05.1
0035: BCF 03.5
0036: BSF 05.1
.................... Delay_ms(17);
0037: MOVLW 11
0038: MOVWF 0F
0039: CALL 004
....................
.................... }
003A: GOTO 024
.................... }
....................
003B: SLEEP
/programy/C/PIC/motory/menice/main.PJT
0,0 → 1,32
[PROJECT]
Target=main.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\PROGRAM FILES\PICC\devices\;C:\PROGRAM FILES\PICC\dr;
Library=
LinkerScript=
 
[Target Data]
FileList=main.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[main.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=main.c
 
[Windows]
0=0000 main.c 0 0 796 451 3 0
 
/programy/C/PIC/motory/menice/main.SYM
0,0 → 1,13
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F delay_ms.P1
delay_us.P1
 
0004 delay_ms
0019 main
 
Project Files:
d:\@kaklik\programy\pic_c\motory\menice\main.c
D:\@Kaklik\programy\PIC_C\motory\menice\main.h
C:\PROGRAM FILES\PICC\devices\16F84.h
/programy/C/PIC/motory/menice/main.c
0,0 → 1,21
#include "D:\@Kaklik\programy\PIC_C\motory\menice\main.h"
 
#DEFINE L1 pin_A0
#DEFINE L2 pin_A1
 
void main()
{
output_low(L1);
output_low(L2);
while(true)
{
output_low(L2);
output_high(L1);
Delay_ms(17);
output_low(L1);
output_high(L2);
Delay_ms(17);
}
}
/programy/C/PIC/motory/menice/main.cod
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
/programy/C/PIC/motory/menice/main.err
0,0 → 1,0
No Errors
/programy/C/PIC/motory/menice/main.h
0,0 → 1,4
#include <16F84.h>
#use delay(clock=4000000)
#fuses HS,WDT
 
/programy/C/PIC/motory/menice/main.sta
0,0 → 1,28
 
ROM used: 60 (6%)
964 (94%) including unused fragments
 
0 Average locations per line
6 Average locations per statement
 
RAM used: 2 (3%) at main() level
3 (4%) worst case
 
Lines Stmts % Files
----- ----- --- -----
22 10 100 d:\@kaklik\programy\pic_c\motory\menice\main.c
5 0 0 D:\@Kaklik\programy\PIC_C\motory\menice\main.h
111 0 0 C:\PROGRAM FILES\PICC\devices\16F84.h
----- -----
276 20 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 35 1 delay_ms
0 35 58 0 main
 
Segment Used Free
--------- ---- ----
0000-0003 4 0
0004-03FF 56 964
 
/programy/C/PIC/motory/menice/main.tre
0,0 → 1,5
ÀÄmain
ÀÄmain 0/35 Ram=0
ÃÄ??0??
ÃÄdelay_ms 0/21 Ram=1
ÀÄdelay_ms 0/21 Ram=1
/programy/C/PIC/motory/menice/prg.bat
0,0 → 1,6
call picpgr stop
call picpgr erase pic16f84
call picpgr program main.hex hex pic16f84
call picpgr run
pause
call picpgr stop
/programy/C/PIC/motory/menice/vssver.scc
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