When I get to my lab, I will send you a snippet of code. bufchar is a byte variable. It can't go over 255, so there must be a couple of variables in there.Originally Posted by eoasap
When I get to my lab, I will send you a snippet of code. bufchar is a byte variable. It can't go over 255, so there must be a couple of variables in there.Originally Posted by eoasap
Thanks Ron, i'm sure there's just something minor i'm leaving out (hopefully!) you've already been such a big help! thanks![]()
Did you ever get this sorted? I'm about to embark on a very similar exercise with a 16F877 and alfatSD board using PBP. Any snippets of code or other advice would be greatly appreciated. TIA
Sorry, I've been out of the country till last night. If at all possible, work with the SD or development board for these units to start with.I am a huge proponent of development kits, they are more money, but cheap in time.Originally Posted by PaulBarter
Alfat is extremely finicky in regards to syntax and timing, and I have spent many hours over "spelling errors" and formatting issues.
Next, if possible, use text mode with the UART. This is the easiest, and most forgiving.Also, the learning curve is more gentle. I was one of the unlucky few that had to use SPI in framed mode. Now, there are plenty of programming examples in "C", and also Proton basic. The latter was invaluable, but required some translation.
SPI gives you the ability to free up your hardware UART and run at some impressive speeds, especially with a MSSP module as on the 18 series chips. You have to account for every single bit going into and out of the Alfat, but it works reliably. I went with framed mode, because it was easier to parse data and error responses(i've had more than my share!). The Alfat user's forum is quite helpful too.
Thanks for that,
I have ordered the ALFATSD board but it'll be a couple of weeks to get to New Zealand. I am planning on using UART in text mode since my application is a simple serial logger.
I've also looked at the proton basic stuff and it looks helpful but I won't know how helpful until I dive into the actual project.
I was hoping you or eoasap had a bare bones PBP program to get me started since I'm not using the proton development board.
Perhaps when I get my chip I'll cobble one together and may re-post if I hit a brick wall. I'm still a bit of a newbie but have had pretty good sucess with serial comms on these chips already. the only unkown is writing this serial data to a text file. Thanks again for the timely reply.
As far as getting text from Alfat, if you know the length of the text string, you can assign a variable array to Alfat's response. Call it Alfat_response.
Let's say you block out 60 bytes to the array. When you use serin2, you can declare,in statement, (Alfat_response\4) the \4 means serin2 will get four consecutive bytes from the input pin. I don't have the book, so syntax is up to you. The display sequence would be to create a loop and LCDout the characters using the loop counter to increment the array
For loop = 0 to 3 ; One less since we start from zero
LCDOUT (Alfat_response[loop])
Next loop
Now, if you don't know how many characters are coming out of Alfat, do the loop, and time it out after 10 milliseconds. Keep in mind that some characters will not print to the LCD. You may have to use 'DEC' or 'HEX' to make any sense of them.
That's all for now,
Ron
Hello again:
I got my Alfat SD board and have made an attempt at getting it to go but with limited success.
Attached is a PBP program that should reset the ALFATSD and then list the files/folders on the card using text mode.
When I run it, all I get as replies from the ALfat are null characters (Dec 0). It doesn't go to the error routine (except once), so I'm pretty sure the connections are good. Note that I'm using B5-7 rather than B0-2.
I'm still a bit of a newbie when it comes to this stuff so any suggestions on how to get this to go would be gratefully accepted. Also, feel free to tell me how crap I am at programming, I've got a pretty thick skin.
I thought the file list would be the simplest way to ensure I was communicating properly but if there's a simpler way to show on the LCD that things are working then let me know.
TIA
-Paul
Bookmarks