BootApp für ältere AVRco Versionen

TheBeginner
Schreiberling
Avatar
Gender: n/a
Location: Wunsiedel Bayern
Age: 66
Posts: 755
Registered: 06 / 2013
Subject:

BootApp für ältere AVRco Versionen

 · 
Posted: 23.07.2015 - 08:19  ·  #1
Wenn jmd es braucht....
die noch eine ältere Version von AVRco haben 3.98
diese Version Arbeitet bei mir sehr gut.
Kommunikation ComPort 19200 8 N 2
ProcClock = 14745600; //Mhz




Code

//   JTAG Ausschalten sonst kein LCD Display
//
//   Kommunikation ComPort 19200 8 N 2
//
program BootApp;

{ $BOOTRST $03800}         {Reset Jump to $03800}
{$NOSHADOW}
{$WG}                      {global Warnings on}
Device = mega32, VCC=5;
Import FlashWrite, SysTick, SerPort, LCDport;
From System Import ;

Define
  ProcClock      = 14745600;       {Hertz}
  SysTick        = 10;             {msec}
  StackSize      = $0064, iData;
  FrameSize      = $0064, iData;
  SerPort        = 19200, Stop2;    {Baud, StopBits|Parity}
  RxBuffer       = 8, iData;
  TxBuffer       = 8, iData;
  LCDport        = PortC;
  LCDtype        = 44780;
  LCDrows        = 4;              {rows}
  LCDcolumns     = 20;             {columns per line}
Implementation

{$IDATA}
{--------------------------------------------------------------}
{ Type Declarations }
type

{--------------------------------------------------------------}
{ Const Declarations }
const
  _BootCheckF[@$6FFE ] : word = $AA55;      // in the standard app area
   DownLoaderID : word = $F3C4;
{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
var
  ch        : char;
  {$Validate FLASHREADPAGE }
  {$Validate FLASHERASEPAGE }
  {$Validate FLASHPROGPAGE }
  {$Validate FLASHWRITEPAGE }
  {$Validate FlashReadFuses }
  {$Validate FlashWriteFuses }
  {$Validate FLASHCLEARPAGE }
{--------------------------------------------------------------}
{ functions }
{$PHASE BootBlock $03800}  //$03800
procedure BootTest;
begin
  FlashDownLoader;
end;
procedure FlashLoaderInit;
begin
   ASM;
   ; >> SERPORT Init <<
   ; >> Baudrate 19200Baud <<
   LDI _ACCA, 018h ; Rx and Tx enable, polling
   OUT ucr1, _ACCA ;
   LDI _ACCA, 02Fh  ; 19200 Baud
   OUT ubrr1, _ACCA ;
   SBI       ucr1, 7;
 ENDASM;
end;
procedure FlashLoaderRecv;
begin
  ASM;
  FLASHLDRRX:
    SBIS      usr1, 7                        ; Receiver ready?
    RJMP      FLASHLDRRX                     ; if not
    IN        _ACCA, udr1
  ENDASM;
end;
procedure FlashLoaderTransm;
begin
  ASM;
  FLASHLDRTX:
    SBIS      usr1, 5                        ; Transmitter ready?
    RJMP      FLASHLDRTX                     ; if not
    OUT       udr1, _ACCA
  ENDASM;
end;
procedure FlashLoaderExit;
begin
   ASM: JMP    SYSTEM.VectTab;
end;
{$DEPHASE BootBlock}


//#####################
// 1 Ausgang  0 Eingang
//#####################
procedure InitPorts;
begin
  PortA := %11111111;
  DDRA  := %11111111;
  PortB := %11111111;
  DDRB  := %11111111;
//LCD
  PortC := %11111111;
  DDRC  := %11111111;
  PortD := %00001111;
  DDRD  := %00001110;
end InitPorts;

{--------------------------------------------------------------}
{ Main Program }
{$IDATA}

begin
  InitPorts;
  EnableInts;
  ch:= ' ';
  LCDcursor(false, false);
  LCDclr;
  LCDxy(0, 0);
  Write(LCDout, 'BootApp Test');
  LCDxy(0, 1);
  Write(LCDout, 'Wait..');
  loop
    ch:= ' ';
    if SerStat then
      ch:= SerInp;
      if ch = 'B' then
        LCDxy(0, 3);
        Write(LCDout, 'Boot startet ' + ch);
        BootTest;
      endif;
    endif;
  endloop;

end BootApp.
You must be logged in or your permissions are to low to see this Attachment(s).
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   36   50 · Page-Gen-Time: 0.021935s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI