I want to use a DS1620 with my PIC16F876. I have been using the DS1620 with my Basic Stamp using PBasic's SHIFTIN and Shiftout command.
These commands are not implemented yet in GCBasic and I read a post about using SPI instead. Can anyone tell me what the source code would look like to accomplish this. I am completly new to GCB and Micro controllers.
Thanks in advance!
Alex
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well I haven't used SPI yet myself, but you could bit-bang the commands out, and read the input back from the DS1620.
You would substitute a subroutine for the shiftin or shiftout commands. Several examples exist in the Contributor forum for writing and reading bytes in GCBasic. Some GCBasic syntax.
Set I/O lines like:
#define Clck PortB.0 'Or whatever port and pins work for you
#define Latch PortB.1
#define DataLine PortB.2
etc.
Set direction of I/O lines like:
Dir Clck Out
Dir Latch Out
Set Constants like:
#define Rconfig 0xAC 'Protocol for DS1620 'Read Configuration'
#define Wconfig 0x0C 'Protocol for DS1620 'Write Configuration'
etc.
Send out a command like:
Set Latch Off
Set Clck On
Shftout(Wconfig) 'A sub to send out a byte to DS1620
Regards,
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I want to use a DS1620 with my PIC16F876. I have been using the DS1620 with my Basic Stamp using PBasic's SHIFTIN and Shiftout command.
These commands are not implemented yet in GCBasic and I read a post about using SPI instead. Can anyone tell me what the source code would look like to accomplish this. I am completly new to GCB and Micro controllers.
Thanks in advance!
Alex
Well I haven't used SPI yet myself, but you could bit-bang the commands out, and read the input back from the DS1620.
You would substitute a subroutine for the shiftin or shiftout commands. Several examples exist in the Contributor forum for writing and reading bytes in GCBasic. Some GCBasic syntax.
Set I/O lines like:
#define Clck PortB.0 'Or whatever port and pins work for you
#define Latch PortB.1
#define DataLine PortB.2
etc.
Set direction of I/O lines like:
Dir Clck Out
Dir Latch Out
Set Constants like:
#define Rconfig 0xAC 'Protocol for DS1620 'Read Configuration'
#define Wconfig 0x0C 'Protocol for DS1620 'Write Configuration'
etc.
Send out a command like:
Set Latch Off
Set Clck On
Shftout(Wconfig) 'A sub to send out a byte to DS1620
Regards,
Kent