Nie mogę ogarnąć wyzwalania i zatrzymywania ponownego tego przebiegu . Jak kontrolować takie start/stop za pomocą zmiennej .
[img ][/img]
Code: [Zaznacz cały] [Rozwiń/Zwiń]
- $REGFILE = "XM128A1UDEF.DAT"
- $CRYSTAL = 48000000 '50MHz
- $HWSTACK = 200
- $SWSTACK = 200
- $FRAMESIZE = 200
- $LIB "XMEGA.LIB"
- ENABLE INTERRUPTS
- '-------------------------------------------------------------------------------------------------------------------------------------------
- 'CONFIG OSC = ENABLED , PLLOSC = ENABLED , PLLMUL = 29
- 'CONFIG SYSCLOCK = PLL
- '-------------------------------------------------------------------------------------------------------------------------------------------
- CONFIG OSC = ENABLED , EXTOSC = ENABLED , PLLOSC = ENABLED , _
- RANGE = 9MHZ_12MHZ , STARTUP = XTAL_16KCLK , PLLSOURCE = EXTCLOCK , PLLMUL = 6 '6 X 8MHZ = 48MHZ 0.000000020833 SEK
- CONFIG SYSCLOCK = PLL , PRESCALEA = 1 , PRESCALEBC = 1_1
- CONFIG PRIORITY = STATIC , VECTOR = APPLICATION , HI = ENABLED , MED = ENABLED , LO = ENABLED
- '*******************************************************************************************************************************************
- '*** DACb **********************************************************************************************************************************
- '*******************************************************************************************************************************************
- CONFIG DACB = ENABLED , IO0 = ENABLED, IO1 = ENABLED, CHANNEL = DUAL , REFERENCE = AVCC , INTERVAL = 64 , REFRESH = 64
- START DACB
- CONFIG PORTB.2 = OUTPUT
- '*******************************************************************************************************************************************
- '*** UART-COM5 *****************************************************************************************************************************
- '*******************************************************************************************************************************************
- CONFIG COM5 = 115200 , MODE = ASYNCHRONEOUS , PARITY = NONE , STOPBITS = 1 , DATABITS = 8
- OPEN "COM5:" FOR BINARY AS #5
- CONFIG SERIALIN4 = BUFFERED , SIZE = 30 , BYTEMATCH = 13
- ENABLE USARTe0_RXC, LO
- DIM RS232_5 AS STRING * 20 'PE3/RS232 TXD0
- DIM COM5 AS LONG ' PE2/RS232 RXD0
- '*******************************************************************************************************************************************
- '*** SD DOS/AVR ****************************************************************************************************************************
- '*******************************************************************************************************************************************
- $INCLUDE "CONFIG_MMCSD_HC.BAS" '• MISO – pin D6 MODUL AL-XAVRB V2.0
- $INCLUDE "CONFIG_AVR-DOS.BAS" '• MOSI – pin D5
- DIM BTEMP1 AS BYTE '• SCK – pin D7
- DIM FF AS BYTE '• CS – pin D4
- BTEMP1 = INITFILESYSTEM(1) '• CARD DETECT – pin D3
- GBDRIVEERROR=0
- FF =FREEFILE()
- '*******************************************************************************************************************************************
- '*** XRAM SDRAM 8MB MT48LC32M4A2P-75IT *****************************************************************************************************
- '*******************************************************************************************************************************************
- CONFIG XRAM = 3PORT , SDBUS = 4 , SDCOL = 10 , SDCAS = 3 , SDROW = 12 , REFRESH = 500 , INITDELAY = 3200 , MODEDELAY = 2 , ROWCYCLEDELAY = 7 , _
- ROWPRECHARGEDELAY = 7 , WRDELAY = 1, ESRDELAY = 7 , ROWCOLDELAY = 7 , MODESEL3 = SDRAM , ADRSIZE3 = 8M , BASEADR3 = &H0000
- $XRAMSIZE = 8000000
- DIM RAM_TAB(720) AS XRAM WORD
- ' out &h8000,1 'zapis 1 do pamieci xram
- ' lol= inp(&h8000) 'odczyt
- '---
- ' odczyt adresu zmiennej
- ' w=varptr(b)
- ' print w
- ' XRAM Start direct after the SRAM range of a XMEGA which is after 16KByte so the first XRAM address is 16384
- ' The maximum XRAM is in case of 8MByte SDRAM = 8000000 - 16384 = 7983616 Byte
- '*******************************************************************************************************************************************
- '*** LCD 240x320 ILI9341 *******************************************************************************************************************
- '*******************************************************************************************************************************************
- CONFIG VPORT0 = E 'NIE TRZEBA PODLACZYC/DODACNA "-" Cs1=CS) Rst=RESET A0=DC Si=SDI Sclk=SCK
- CONFIG GRAPHLCD = COLOR , CS1 = PORT0.0 , RST = PORT0.6 , A0 = PORT0.5 , SI = PORT0.4 , SCLK = PORT0.7
- CONST PORTRAIT=0
- CONST ROTATE_180 = 1
- DIM OFFSET256 AS BYTE
- $LIB "glcd-ILI9341_2R8_240x320.lib"
- INITLCD
- CLS
- CONST BLACK = &B0000_0000
- CONST RED = &B1110_0000
- CONST GREEN = &B0001_1100
- CONST BLUE = &B0000_0011
- CONST MAGENTA = &B1110_0011
- CONST YELLOW = &B1111_1100
- CONST CYAN = &B0001_1111
- CONST WHITE = &B1111_1111
- CONST ORANGE = &B1111_0100
- CONST BRIGHTGREEN = &B0011_1110
- CONST BRIGHTBLUE = &B0001_1111
- CONST DARKRED = &B1100_0000
- CONST DARKGREEN = &B0001_0100
- CONST DARKBLUE = &B0000_0010
- OFFSET256 = 1
- BOXFILL (0 , 0) - (64 , 240) , BLACK
- OFFSET256 = 0
- BOXFILL (0 , 0) - (255 , 240) , BLACK
- SETFONT COLOR8X8
- 'SETFONT COLOR16X16
- '******************************************************************************************************************************************
- '*** ZMIENNE ******************************************************************************************************************************
- '******************************************************************************************************************************************
- DIM KAT AS WORD
- DIM SINUS AS WORD
- DIM DANE(180) AS WORD
- dim skacz as word
- '******************************************************************************************************************************************
- '*** PROGRAM ******************************************************************************************************************************
- '******************************************************************************************************************************************
- RESTORE SIN_DATA:
- FOR KAT = 1 TO 90
- READ SINUS
- DANE(KAT)=SINUS
- NEXT
- '******************************************************************************************************************************************
- '*** DMA0 *********************************************************************************************************************************
- '******************************************************************************************************************************************
- CONFIG TCC0 = NORMAL , PRESCALE = 1
- TCC0_PER = 65535
- CONFIG EVENT_SYSTEM = DUMMY , MUX0 = TCC0_OVF
- CONFIG DACB = ENABLED , Io0 = ENABLED , Io1 = ENABLED , CHANNEL = DUAL , REFERENCE = AVCC , INTERVAL = 4 , REFRESH = 16 , TRIGGER_CH0 = ENABLED , EVENT_CHANNEL = 0
- CONFIG DMA = ENABLED , DOUBLEBUF = DISABLED , CPM = RR
- CONFIG DMACH0 = ENABLED , BURSTLEN = 2 , CHANRPT = ENABLED , TCI = OFF , EIL = OFF , SINGLESHOT = ENABLED , SAR = BLOCK , _
- SAM = INC , DAR = BURST , DAM = INC , TRIGGER = &H25 , BTC = 180 , REPEAT = 0 , SADR = VARPTR(DANE(1)) , DADR = VARPTR(DACB_CH0DATAL)
- COM5=65535
- DO
- LCDAT 10 , 0 , "DMA_CTRL :" ;BIN(DMA_CTRL) ;" ", WHITE , BLACK
- LCDAT 20 , 0 , "DMA_INTFLAGS :" ;BIN(DMA_INTFLAGS) ;" ", WHITE , BLACK
- LCDAT 30 , 0 , "DMA_STATUS :" ;BIN(DMA_STATUS) ;" ", WHITE , BLACK
- LCDAT 40 , 0 , "DMA_TEMP :" ;BIN(DMA_TEMP) ;" ", WHITE , BLACK
- LCDAT 50 , 0 , "DMA_CH0_CTRLA :" ;BIN(DMA_CH0_CTRLA) ;" ", WHITE , BLACK
- LCDAT 60 , 0 , "DMA_CH0_CTRLB :" ;BIN(DMA_CH0_CTRLB) ;" ", WHITE , BLACK
- LCDAT 70 , 0 , "DMA_CH0_ADDRCTRL :" ;BIN(DMA_CH0_ADDRCTRL) ;" ", WHITE , BLACK
- LCDAT 80 , 0 , "DMA_CH0_TRIGSRC :" ;BIN(DMA_CH0_TRIGSRC) ;" ", WHITE , BLACK
- LCDAT 110 , 0 , "DMA_CH0_TRFCNT :" ;DMA_CH0_TRFCNT ;" ", WHITE , BLACK
- LCDAT 120 , 0 , "DMA_CH0_REPCNT :" ;DMA_CH0_REPCNT ;" ", WHITE , BLACK
- LCDAT 130 , 0 , "DMA_CH0_SRCADDR0 :" ;DMA_CH0_SRCADDR0 ;" ", WHITE , BLACK
- LCDAT 140 , 0 , "DMA_CH0_SRCADDR1 :" ;DMA_CH0_SRCADDR1 ;" ", WHITE , BLACK
- LCDAT 150 , 0 , "DMA_CH0_SRCADDR2 :" ;DMA_CH0_SRCADDR2 ;" ", WHITE , BLACK
- LCDAT 160 , 0 , "DMA_CH0_DESTADDR0:" ;DMA_CH0_DESTADDR0 ;" ", WHITE , BLACK
- LCDAT 170 , 0 , "DMA_CH0_DESTADDR0:" ;DMA_CH0_DESTADDR1 ;" ", WHITE , BLACK
- LCDAT 180 , 0 , "DMA_CH0_DESTADDR0:" ;DMA_CH0_DESTADDR2 ;" ", WHITE , BLACK
- LCDAT 200 , 0 , "COM5 ";COM5 , WHITE, BLACK
- TCC0_PER=COM5
- LOOP
- END
- '-------------------------------------------------------------------------------------------------------------------------------------------
- '$INCLUDE "COLOR16x16.FONT"
- $INCLUDE "COLOR8x8.FONT"
- '-------------------------------------------------------------------------------------------------------------------------------------------
- SERIAL4CHARMATCH:
- PUSHALL
- INPUT #5 , RS232_5 NOECHO
- COM5 = VAL(RS232_5)
- POPALL
- RETURN
- 'DMA_INT:
- 'RETURN
- SIN_DATA:
- DATA 2081%,2216%,2352%,2485%,2617%,2745%,2871%,2992%,3109%,3220%,3326%,3425%,3518%,3604%,3682%,3752%
- DATA 3814%,3867%,3911%,3947%,3972%,3989%,3996%,3994%,3982%,3961%,3930%,3890%,3841%,3784%,3718%,3644%
- DATA 3562%,3473%,3376%,3274%,3165%,3051%,2932%,2808%,2681%,2551%,2419%,2284%,2149%,2012%,1877%,1741%
- DATA 1608%,1476%,1348%,1222%,1101%,984%,873%,767%,668%,575%,489%,411%,341%,279%,226%,182%
- DATA 146%,121%,104%,97%,99%,111%,132%,163%,203%,252%,309%,375%,449%,531%,620%,717%
- DATA 819%,928%,1042%,1161%,1285%,1412%,1542%,1674%,1809%,1944%