📄 dosreadraw1.c
字号:
//###################################################################################
// File: dostest.c
//
// Liest eine Datei auf dem CF bis zum Ende.
//
//#########################################################################
// Last change: 22.03.2004
//#########################################################################
// holger.klabunde@t-online.de
// http://home.t-online.de/home/holger.klabunde/homepage.htm
//#########################################################################
// Processor: ATMega32
//#########################################################################
// Compiler: AVR-GCC 3.2
//#########################################################################
#include <io.h>
#include <interrupt.h>
#include <sig-avr.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "mydefs.h"
#include "protos.h"
#include "../lcd.h"
#include "../dos.h"
//"volatile" f黵 alle Variablen die in Interrupt's ge鋘dert werden
unsigned int volatile countclock;
//###################################################################################
// timeout not used !
// interrupt every 47.4ms @ 11.0592MHz
// interrupt every 32.77ms @ 16.0000MHz
SIGNAL(SIG_OVERFLOW1) // signal handler for timer1 overflow interrupt
//###################################################################################
{
countclock++;
}
//###################################################################################
/* Hauptprogramm */
int main(void)
//###################################################################################
{
DDRC=0xFF; // set io-pins on PortC
PORTC=0; //LCD-Datenbus
DDRD=0xF2; // set io-pins on PortD
PORTD=0x02; //LCD-Steuersignale siehe lcd.h
DDRA=0; //Alles Eing鋘ge
PORTA=0xFF; //Eing鋘ge mit Pullups setzen
#ifdef COMPACTFLASH_CARD
DDRB=0xFF; //Alles Ausg鋘ge
PORTB=0xFF;
#endif
#ifdef MMC_CARD_SPI
// DDRB=0b10111111;
DDRB=0xBF; //PB7=SCK,PB6=MISO,PB5=MOSI,PB4=MMC_CS,PB3..0 not used
PORTB=0x10;
#endif
SFIOR&=!(1<<PUD); //Pullups Enable
// SFIOR=0; //Pullups Enable
LCDInit();
//Timer1
TCCR1A=0;
TCCR1B=0x02; //Timer1 Start Takt = F/8 => 47.4ms at 11.059MHz
TIMSK=(1<<TOIE1); // enable timer1 int
sei(); //enable interrupts
LCDCls();
LCDWrite("FAT DOS-ReadFileRaw-Test1");
LCDPos(2,1);
LCDWrite("by Holgi");
Delay1ms(1000);
LCDCls();
if(GetDriveInformation()!=F_OK) // get drive parameters
{
LCDCls();
LCDWrite("Flash meldet sich nicht !");
while(1);
}
RED_ON();
GREEN_OFF();
countclock=0;
ReadFileRaw("1.txt");
GREEN_ON();
RED_OFF();
cli(); // Disable interrupts
LCDPos(1,1);
ShowHex((unsigned char)(FilePosition>>24));
ShowHex((unsigned char)(FilePosition>>16));
ShowHex((unsigned char)(FilePosition>>8));
ShowHex((unsigned char)(FilePosition));
LCDPos(2,1);
ShowHex((unsigned char)(countclock>>8));
ShowHex((unsigned char)(countclock));
for(;;) // loop forever
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -