Bartosz Wypych
New Member
Hello everyone!
Last time I try to solve my microcontroller picaxe 20x2 for additional text data in the *. txt file on SD set via SD card module in an alternative way:
Dubious link deleted - moderator
I have everything soldered and connected. On the program with detailed products pins for this module in Basic, but my code does not work.
I do not know how to change my program to solve the problem, I may misdefine the ports. navigation very important for help and advice.
I am sending my code, which has changed below:
Last time I try to solve my microcontroller picaxe 20x2 for additional text data in the *. txt file on SD set via SD card module in an alternative way:
Dubious link deleted - moderator
I have everything soldered and connected. On the program with detailed products pins for this module in Basic, but my code does not work.
I do not know how to change my program to solve the problem, I may misdefine the ports. navigation very important for help and advice.
I am sending my code, which has changed below:
Code:
' Pin configuration and SPI interface
symbol SD_CS_PIN = C. 2' Pin CS (Chip Select) SD Card
symbol MOSI_PIN = C. 0 ' PIN MOSI (Master Out Slave In)
MISO_PIN symbol = C. 7' PIN MISO (Master In Slave Out)
symbol SCK_PIN = C. 5' Pin SCK (serial clock)
results from the given m8
' Configure pins for SD cards
high SD_CS_PIN 'setting the CS pin to high state (SD card inactive)
serout SCK_PIN, N2400_8, ($FF) ' Sending byte to use SPI interface
' Function to initialize SD cards
initSD:
low SD_CS_PIN' SD card activation
serout SCK_PIN, N2400_8, (40$, 0, 0, 0, 0, 0, 0, 95$) ' Initialization Command
pause 100' Wait for initialization
High SD_CS_PIN' SD Card Deactivation
back
gosub initSD
Function of extra text to file on SD demand
save to SD:
low SD_CS_PIN' SD card activation
serout SCK_PIN, N2400_8, ($41, 0, 0, 0, 0, $95) ' Write command
Pause 100' Wait for SD cards to be ready
serout SCK_PIN, N2400_8, ("Hello, World!") ' Sample text to write
High SD_CS_PIN' Deactivate SD Cards
back
gosub save to SD
Main Program
Main:
call initSD ' Initialize SD cards
' Here you get the code that was uploaded before saving the file
saveToSD ' Save to description SD
Last edited by a moderator: