Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ATmega168 7-Segmentni Display
Kako se definira array u assembleru i popunjuje sa zadatim vrijednostima? Ja sam pokušao ovako:

.DSEG
digit: .Byte 9 ; 7 Segments Digits

I u Reset funkciji nakon initilizacije stack pointera popunjavam array:

; load 7 segments digits into array (&h3f, &h06, &h5b, &h4f, &h66, &h6d, &h7d, &h07, &h7f, &h6f)
ldi xl,byte1(digit)
ldi xh,byte2(digit)
ldi zl,0x3f
st X+,zl
ldi zl,0x06
st X+,zl
ldi zl,0x5b
st X+,zl
ldi zl,0x4f
st X+,zl
ldi zl,0x66
st X+,zl
ldi zl,0x6d
st X+,zl
ldi zl,0x7d
st X+,zl
ldi zl,0x07
st X+,zl
ldi zl,0x7f
st X+,zl
ldi zl,0x6f
st X+,zl

Dakle učitavam array pointer u registre xl i xh (2x8bit), ulitavam vrijednosti segmenta u zl registar i postavljam u SRAM vrijednost jednu za jednom jer RAM nije definirani kao array nego ide vrijednost po vrijednosti...sa X+ zapisujem na sljedecu adresu vrijednost i povecavam pointer(pokazatelj na sljedecu memorijsku lokaciju) na koju ce se zapisati sljedeci podatak iz indirektnog CPU registra zl...dakle sad koristim indirektno adresiranje.

Sad me zanima dali je tako ok i koji je pravilni način? u .DSEG sam definirao 9 bytova u memoriji veličinu arraya koji ce mi sadrzavati brojke od 0 do 9 dakle tocno 9 bytova.

UPDATE:

X Y registri su SRAM lokacije a Z je Program Memory ili ti FLASH lokacija...tako da gornji kod:

ldi zl,byte1(63) ; LOAD - &h3f To Program Memory
st X+,zl ; STORE - &h3f From Program Memory Into SRAM location

Dakle stavljamo &h3f (63dec) vrijednost u programsku memoriju i zatim iz programske memorije kopiramo u SRAM poziciju i incrementiramo SRAM brojač X+....sad me zanima zasto se u ovom primjeru direktno ne upisuje u SRAM? Npr ovako:

ldi yl, LOW(&h3f)
st X+, yl

Tako bi direktno upisali u SRAM vrijednost 3f i samo bi kao u kodu inkrementirali X+ brojac SRAM lokacije da zapisuje array vrijednosti jednu za drugu...time bi kod bio kraci a i vjerujem da je vrijeme citanja iz Flasha 3cycle a SRAM-a 2cycla koliko sam uspio naci info u datasheetu...dakle ovako gubimo 5cycle za upis jedne array brojke iz Flasha u SRAM a ako bi direktno upisivali u SRAM dosli bi na 3cycle sto mi puno logicnije izgleda..pa molim objasnjenje zasto nebi isli direktno upisivat u SRAM?
SAMO-BANOVAN OD 01.11.2024
Reply


Messages In This Thread
ATmega168 7-Segmentni Display - by ronovar - 03-29-2018, 07:44 PM
RE: ATmega168 7-Segmentni Display - by Milan94 - 03-29-2018, 08:37 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-29-2018, 09:27 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 03-30-2018, 10:43 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 03-29-2018, 09:55 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-29-2018, 10:12 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 03-29-2018, 10:31 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-29-2018, 10:38 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 03-29-2018, 11:02 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-30-2018, 07:43 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 03-30-2018, 08:17 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-30-2018, 09:41 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-30-2018, 10:51 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 03-30-2018, 11:17 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-30-2018, 11:33 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 03-30-2018, 12:01 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-30-2018, 02:46 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-30-2018, 12:14 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 03-30-2018, 12:24 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 03-30-2018, 12:32 PM
RE: ATmega168 7-Segmentni Display - by Milan94 - 03-30-2018, 03:55 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 03-30-2018, 04:23 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 03-30-2018, 05:26 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-30-2018, 06:08 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 03-30-2018, 08:07 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 03-30-2018, 08:25 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 03-30-2018, 09:52 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 03-30-2018, 10:21 PM
RE: ATmega168 7-Segmentni Display - by Želja - 03-31-2018, 08:31 AM
RE: ATmega168 7-Segmentni Display - by Macola - 03-31-2018, 12:52 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 03-31-2018, 01:57 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-01-2018, 02:11 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-01-2018, 02:23 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-01-2018, 03:00 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-01-2018, 08:17 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-01-2018, 09:22 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-01-2018, 09:24 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-01-2018, 09:32 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-01-2018, 09:45 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-01-2018, 09:41 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-01-2018, 09:53 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-01-2018, 09:48 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-01-2018, 09:59 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-01-2018, 10:04 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-01-2018, 10:09 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 08:39 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-02-2018, 09:23 AM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-02-2018, 10:04 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 11:17 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 08:54 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 09:28 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-02-2018, 09:34 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 02:01 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 03:42 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 02:41 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 03:44 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 04:28 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 04:40 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-02-2018, 04:55 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 05:05 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-02-2018, 07:57 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 08:17 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 07:58 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 08:24 PM
RE: ATmega168 7-Segmentni Display - by Milan94 - 04-02-2018, 09:11 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 09:40 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 10:21 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 10:31 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 10:37 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 10:51 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 11:05 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 10:57 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 11:11 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-02-2018, 11:08 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 11:15 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 11:17 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 11:20 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 11:21 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 11:25 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 11:30 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-02-2018, 11:27 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 11:49 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-03-2018, 07:19 AM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 11:28 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 11:48 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-02-2018, 11:52 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-02-2018, 11:56 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-03-2018, 12:03 AM
RE: ATmega168 7-Segmentni Display - by Želja - 04-03-2018, 07:25 AM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-03-2018, 10:16 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-03-2018, 07:50 AM
RE: ATmega168 7-Segmentni Display - by 1van - 04-03-2018, 10:05 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-03-2018, 10:24 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 10:56 AM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-03-2018, 11:21 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-03-2018, 11:37 AM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-03-2018, 12:02 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-03-2018, 12:06 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 12:11 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-03-2018, 12:48 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 04:16 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-03-2018, 04:34 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-03-2018, 08:02 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 08:52 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-03-2018, 09:15 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 09:30 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-03-2018, 09:39 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-03-2018, 09:55 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 09:58 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-03-2018, 10:05 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-03-2018, 10:07 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 10:16 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-03-2018, 10:24 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 10:34 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-03-2018, 10:42 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-03-2018, 11:14 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-03-2018, 11:25 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-03-2018, 11:52 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-04-2018, 12:00 AM
RE: ATmega168 7-Segmentni Display - by Macola - 04-04-2018, 12:14 AM
RE: ATmega168 7-Segmentni Display - by 1van - 04-04-2018, 07:03 AM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-04-2018, 12:30 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-04-2018, 06:20 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-04-2018, 08:58 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-04-2018, 09:53 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-04-2018, 10:00 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-04-2018, 02:08 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-04-2018, 03:23 PM
RE: ATmega168 7-Segmentni Display - by Macola - 04-04-2018, 03:53 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-04-2018, 10:27 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-05-2018, 05:06 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-05-2018, 06:47 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-05-2018, 08:52 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-08-2018, 10:48 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-08-2018, 06:49 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-08-2018, 08:16 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-08-2018, 09:17 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-08-2018, 11:09 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-09-2018, 08:28 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-09-2018, 11:56 AM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-09-2018, 12:21 PM
RE: ATmega168 7-Segmentni Display - by Makso - 04-09-2018, 12:24 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-09-2018, 01:01 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-09-2018, 02:13 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-10-2018, 08:21 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-10-2018, 03:52 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-10-2018, 07:58 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-10-2018, 08:32 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-10-2018, 08:54 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-10-2018, 09:35 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-10-2018, 09:51 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-10-2018, 09:52 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-11-2018, 06:54 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-11-2018, 07:08 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-11-2018, 08:39 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-11-2018, 08:44 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-11-2018, 10:09 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-11-2018, 10:48 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-11-2018, 11:13 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-12-2018, 12:14 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-12-2018, 06:51 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-12-2018, 08:15 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-12-2018, 09:35 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-12-2018, 09:42 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-12-2018, 09:57 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-12-2018, 10:05 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-12-2018, 10:14 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-12-2018, 10:30 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-12-2018, 10:48 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-12-2018, 11:05 AM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-12-2018, 11:36 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-12-2018, 11:56 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-12-2018, 05:33 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-12-2018, 10:51 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-16-2018, 09:00 PM
RE: ATmega168 7-Segmentni Display - by gorankg - 04-16-2018, 09:56 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-14-2018, 09:33 PM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-15-2018, 06:33 AM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-15-2018, 08:58 AM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-15-2018, 10:56 AM
RE: ATmega168 7-Segmentni Display - by vojinilic - 04-15-2018, 01:04 PM
RE: ATmega168 7-Segmentni Display - by mikikg - 04-15-2018, 01:51 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-16-2018, 10:02 PM
RE: ATmega168 7-Segmentni Display - by ronovar - 04-17-2018, 11:42 AM

Forum Jump:


Users browsing this thread: 4 Guest(s)