View Full Version : Sparkfun DosOnChip
tico
- 14th April 2007, 02:47
I am attempting to write some code to interface with one of there modules,
Unfortunately I cant do any testing due to the fact they wont be in stock until May.
If some of you use these please let me know if I am on the right track.
@ DEVICE PIC16F877A,XT_OSC
include "modedefs.bas"
define CHAR_PACING 100
define OSC 20
DEFINE debug_mode 0 ' Debug sending True serial data
DEFINE debug_reg portc ' Debug Port = PortC
DEFINE debug_bit 6 ' Debug.bit = PortC.6
DEFINE debug_baud 9600 ' Default baud rate = 9600
DEFINE osc 20 ' We're using a 20 MHz oscillator
DEFINE ADC_BITS 8 ' Set A/D for 8-bit operation
DEFINE ADC_CLOCK 3 ' Set A/D clock r/c
DEFINE ADC_SAMPLEUS 50 ' Set A/D sampling time @ 50 uS
Define LCD_DREG PORTD ' Define LCD pins
Define LCD_DBIT 4 'use upper 4 bits d4-d7
Define LCD_RSREG PORTD
Define LCD_RSBIT 2
Define LCD_EREG PORTD
Define LCD_EBIT 3
DEFINE LCD_LINES 2
Define LCD_COMMANDUS 2000 ' Command Delay (uS)
Define LCD_DATAUS 50 ' Data Delay (uS)
start:
toggle portc.3
serout portc.5,N9600,[13,13] 'send init autobaud string
serout portc.5,N9600,["ow",13] 'open file for writing
serout portc.5,N9600,["w","This is a test",13] 'write this is a test to sd
serout portc.5,N9600,["q",13] 'close file
pause 1000
goto start
tico
- 15th April 2007, 01:07
47 views and so one can even tell me if I am on the right track.
Archangel
- 15th April 2007, 02:12
Hi Tico,
I am a viewer, and I have never used the modules you suggested you are about to use. I do have a comment though, Why did you bother to setup for use of debug logic true, and then call serout N9600 which if memory serves is inverted?
In fact why bother to setup debug at all as you have not used it in your code?
And then there are defines for a parallel LCD. How many LCD units are you going to use?
tico
- 15th April 2007, 02:32
The answer is simple I removed the code that was not relavant, The defines are for the final code. One port is being used as a debug port (portc.6) another port (portc.5) is being used to comm. with the DosOnChip module. I am not using a 232 driver just the resistor method that is why I stated N9600.
The define for the LCD is what the final code will use, I wil only be using one LCD module.
mister_e
- 15th April 2007, 18:10
You defined a 20 MHZ crystal, but set a XT osc... must be HS osc.
Also make sure you disable the LVP mode as well.
And the universal question.... why using SEROUT while this PIC have a built-in USART?
O.K. you need an inverted mode....
tico
- 16th April 2007, 04:02
Thanks for the advice mister_e.
I am using the ezpic 4 dev board. I have quite a few more defines than needed for this example.
So does this mean that I have written the commands to the DosOnChip module correctly? I have read the data sheet but not sure If i understood it corectly.
I would like to start coding now since the modules will not be available for at least another month. They are claiming and arrival date of 2007-06-10, figures I found something else to tinker with and cant get one untill June.
I am guessing that I need inverted mode to comm. with the module I figure two resistors are cheaper than a max233
leharker
- 16th April 2007, 15:23
Tico,
I have used those modules in a project last fall. Be prepared for some head scratching. These modules do have "potential" but the manual leaves a lot to be desired. I spent nearly a week of hair pulling and lots of web searching before I got the thing to work. My boss was quite pissed about that! I contacted Sparkfun, the original distributor, and the guy at DOSONCHIP and they were both quite aware of the inacuracies of the manual and even today their website claims to be updating it in January of 2007. Here it is April 2007. I talked to those folks in October and they seemed almost unconcerned that the device was a bitch to work with and the manual was confusing. And I've got over 25 years experience in electronics.
I don't get it!
I was stuck because I had already designed the PCB for 13 units and had all the other parts ready to go. I did figure it out and used it but it was a pain. They have one advantage over the competition and that is the small footprint.
I don't have all my notes with me but here are some things from memory.
The reset pin can't be left unconnected as mentioned in the manual. Also if memory serves, the CTS line active state is reversed.
The command for writing is the most criptic thing I remember. When you send the command for write, you follow it with the number of bytes you intend to send. The module sends the quote character back to you and then you follow with the actual bytes. There is no way I could have deciphered that from the manual. I got that info from another "hair puller" on the internet.
My advice to you is to hook the thing up on a breadboard and practice using it with Hyperterminal before you even think of using it with your microcontroller. I did that so I could actually see what the thing was doing.
Good luck.
Ron Marcus
- 16th April 2007, 15:58
Try the AlFAT chips
I've worked with these guys before, and they have worked out all(most) of the bugs.
www.ghielectronics.com/details.php?id=1
Ron
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.