Sistema

Sezione dedicata ai Microcontrollori e ai Sistemi Embedded

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 05 Nov 2016, 16:02

schema.rar
(81.18 KiB) Downloaded 418 times
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 05 Nov 2016, 20:10

rigol.rar
(81.36 KiB) Downloaded 448 times
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby legacy » 06 Nov 2016, 08:36

se sono immagini e non pdf o progetti
non ha senso includerli come allegato
compresso, il forum gestisce immagini
Last edited by legacy on 06 Nov 2016, 12:09, edited 1 time in total.
legacy
 
Posts: 862
Joined: 12 Mar 2012, 11:30

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 06 Nov 2016, 10:45

Ecco il codice attuale:

Code: Select all
  PORT_B EQU 0x06                   ; shadow copy of GPIO
   


    ;************************************************************************
    org 0x0000           ; effective reset vector
   

    ;***** MAIN PROGRAM

    ;***** Initialisation
    start   
            movlw   b'00000000'       ; configure GP2 (only) as an output
            tris    PORT_B

            clrf    PORT_B           ; start with shadow GPIO zeroed

    ;***** Main loop
    INIZIO:
            bcf PORT_B,0
            bsf PORT_B,0
            goto INIZIO           ; repeat forever
   
   END
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 07 Nov 2016, 13:25

Cancellato
Attachments
Immagine_RIGOL.rar
(109.46 KiB) Downloaded 408 times
Last edited by alieno75 on 26 May 2018, 07:32, edited 1 time in total.
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 07 Nov 2016, 13:26

Cancellato
Last edited by alieno75 on 26 May 2018, 07:32, edited 1 time in total.
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby legacy » 07 Nov 2016, 13:41

alieno75 wrote:Immagine_RIGOL.rar


perche' continui a mettere le immagini dentro un rar?
e' fastidioso dover scaricare un allegato
sopratutto se usi sempre lo stesso *filename*
ogni volta si creano alias su alias nella cartella download
che tocca poi cancellare, e non ha senso alcuno quando
il forum sa benissimo gestire le immagini!
Last edited by legacy on 07 Nov 2016, 20:18, edited 1 time in total.
legacy
 
Posts: 862
Joined: 12 Mar 2012, 11:30

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 07 Nov 2016, 13:47

Cancellato
Last edited by alieno75 on 26 May 2018, 07:31, edited 1 time in total.
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby legacy » 07 Nov 2016, 13:49

alieno75 wrote:Per non mettere un' immagine che occupa tutto il post


puoi ridimensionare
oppure puoi usare postimage e simili ed includere l'immagine come link esterno
url = …. ]nome immagine[ ….
Last edited by legacy on 07 Nov 2016, 20:16, edited 1 time in total.
legacy
 
Posts: 862
Joined: 12 Mar 2012, 11:30

Re: Problema con prototipo calcolatrice z80

Postby legacy » 07 Nov 2016, 13:51

1> /dev/null 2> /dev/null | echo "+1" :roll:
Last edited by legacy on 07 Nov 2016, 22:17, edited 4 times in total.
legacy
 
Posts: 862
Joined: 12 Mar 2012, 11:30

Re: Problema con prototipo calcolatrice z80

Postby legacy » 07 Nov 2016, 15:51

+1

ti segue solo 4Fun perche' e' un Santo
anzi Santo Subito, la pazienza infinita
Last edited by legacy on 07 Nov 2016, 20:16, edited 1 time in total.
legacy
 
Posts: 862
Joined: 12 Mar 2012, 11:30

Re: Problema con prototipo calcolatrice z80

Postby Just4Fun » 07 Nov 2016, 18:44

dsc_8657.jpg
dsc_8657.jpg (84.36 KiB) Viewed 13537 times


Ovviamente quello che ho appoggiato al braccio è la 1° edizione rilegata extralusso del datasheet dell'Intel 4004... :lol:
User avatar
Just4Fun
 
Posts: 153
Joined: 13 May 2016, 18:17

Re: Problema con prototipo calcolatrice z80

Postby Just4Fun » 10 Nov 2016, 21:52

Nel seguito lo schema di riferimento x collegare il PIC16F877 con i segnali generati, il flow della prima parte e il prog in assembler da testare se ok (ho provato a compilarlo con MPLAB IDE 8.82 e non ha dato errori):

Code: Select all
  list           p=16F877     
  #include       <p16F877.inc>


;***** VARIABLE DEFINITIONS

        UDATA
d1      res 1                   ; delay loop counters
d2      res 1
d3      res 1 
d4      res 1 
     

;************************************************************************
RESET   CODE    0x0000          ; effective reset vector
       

;***** MAIN PROGRAM

;***** Initialisation
start   
       movlw   b'11111000'      ; configure RB0, RB1, RB2 as output, others as input
       tris    PORTB

      bsf    PORTB,0         ; RB0 = CLOCK = 1
      bcf    PORTB,1         ; RB1 = RESET = 0 (active LOW)
      bcf    PORTB,2           ; RB2 = LED = ON (active LOW)

;***** Main loop
do_reset
      ;  do a 0.4s RESET LOW and send 1-0-1 1us clock pulses
      movlw   0x36         ; initialize delay counters
      movwf   d1
      movlw   0xE0
      movwf   d2
      movlw   0x01
      movwf   d3
delay_0
      bcf    PORTB,0            ; CLOCK = 0   
      bsf    PORTB,0            ; CLOCK = 1
      decfsz   d1, f
      goto   $+2
      decfsz   d2, f
      goto   $+2
      decfsz   d3, f
      goto   delay_0
   
      ; all done, so turn off LED and RESET
      bsf    PORTB,2           ; LED OFF
      bsf    PORTB,1           ; RESET = 1
   
      ;loop forever
endless
      goto    endless
     
      END



Ti conviene aggiungere un Led sul segnale M1 dello Z80 (vedi schema), così saprai quando stai eseguendo una nuova istruzione...
Attachments
Schema.pdf.zip
(200.23 KiB) Downloaded 416 times
Flow.pdf.zip
(163.1 KiB) Downloaded 416 times
User avatar
Just4Fun
 
Posts: 153
Joined: 13 May 2016, 18:17

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 11 Nov 2016, 17:09

Cancellato
Last edited by alieno75 on 26 May 2018, 07:33, edited 1 time in total.
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 13 Nov 2016, 15:31

Cancellato
Last edited by alieno75 on 26 May 2018, 07:34, edited 1 time in total.
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 13 Nov 2016, 15:42

Cancellato
Last edited by alieno75 on 26 May 2018, 07:34, edited 1 time in total.
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby Just4Fun » 15 Nov 2016, 22:33

Ecco il prog completo che ho testato usando un PIC16F876 che avevo:

Code: Select all
      list           p=16F877     
      #include       <p16F877.inc>


;***** VARIABLE DEFINITIONS

        UDATA
d1      res 1                   ; delay loop counters
d2      res 1
d3      res 1 
d4      res 1 
     

;************************************************************************
RESET   CODE    0x0000          ; effective reset vector
       

;***** MAIN PROGRAM

;***** Initialisation
start   
       movlw   b'00000001'     ; configure RB0 (PUSH BUTTON active LOW) as input, others as output
       tris    PORTB
       
       banksel   OPTION_REG
       bcf      OPTION_REG,NOT_RBPU   ; enable pull-ups on PORTB inputs
       banksel   PORTA

      movlw   b'111110'       ; configure RA0 (LED) as output, others as input
      tris    PORTA     

      bsf       PORTB,RB1      ; RB1 = CLOCK = 1
      bcf       PORTB,RB2         ; RB2 = RESET = 0 (active LOW)
      bcf       PORTA,RA0       ; RA0 = LED = ON (active LOW)

;***** Main loop
do_reset
      ;  do a 0.5s RESET LOW and send 1-0-1 1us clock pulses
      movlw   0x36         ; initialize delay counters
      movwf   d1
      movlw   0xE0
      movwf   d2
      movlw   0x01
      movwf   d3
delay_0
      bcf    PORTB,RB1       ; CLOCK = 0 (make a clock 1us 1-0-1 pulse)
       bsf    PORTB,RB1       ; CLOCK = 1
      decfsz   d1, f
      goto   $+2
      decfsz   d2, f
      goto   $+2
      decfsz   d3, f
      goto   delay_0
   
      ; all done, so turn off LED and RESET
      bsf    PORTA,RA0         ; LED OFF
      bsf    PORTB,RB2         ; RESET = 1
   
      ; Make a clock single pulse (0-1-0) if the PUSH BUTTON is pressed
test_pb
        btfsc   PORTB,RB0      ; PUSH BUTTON (RB0) pressed (active LOW)?
        goto    test_pb         ; No (is HIGH), test it again
        bcf       PORTA,RA0      ; Yes (is LOW), turn LED ON
       
        bcf       PORTB,RB1       ; CLOCK = 0   (make a clock 1us 1-0-1 pulse)
        bsf       PORTB,RB1       ; CLOCK = 1   
         
        ; 0.1s delay, than LED OFF 
        movlw   0x1F         ; initialize delay counters (0.1s)
      movwf   d1
      movlw   0x4F
      movwf   d2
Delay_1
      decfsz   d1, f
      goto   $+2
      decfsz   d2, f
      goto   Delay_1
      bsf       PORTA,RA0       ; LED OFF
   
      ; wait 0.4s before test PUSH BUTTON again
      movlw   0x36         ; initialize delay counters (0.4s)
      movwf   d1
      movlw   0xE0
      movwf   d2
      movlw   0x01
      movwf   d3
Delay_3
      decfsz   d1, f
      goto   $+2
      decfsz   d2, f
      goto   $+2
      decfsz   d3, f
      goto   Delay_3
      goto   test_pb
     
      END


Premendo il pulsante dopo la fase di reset, viene generato un impulso di clock singolo, tenendo premuto il pulsante vengono generati impulsi di clock uno ogni 0.5s (finché si mantiene premuto).

Qui il "treno" di impulsi di clock (in giallo) ed il segnale di reset (in celeste) durante la fase iniziale di reset:
F1.jpeg
F1.jpeg (75.36 KiB) Viewed 13452 times


Dettaglio della fase finale di reset. Notare come il clock venga bloccato ad 1 prima di disattivere il segnale di reset:
F2.jpeg
F2.jpeg (74.9 KiB) Viewed 13452 times


Questo è il singolo impulso di clock generato premendo il pulsante:
F3.jpeg
F3.jpeg (76.41 KiB) Viewed 13452 times
User avatar
Just4Fun
 
Posts: 153
Joined: 13 May 2016, 18:17

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 16 Nov 2016, 16:51

Cancellato
Last edited by alieno75 on 26 May 2018, 07:35, edited 1 time in total.
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby alieno75 » 16 Nov 2016, 16:52

Cancellato
Last edited by alieno75 on 26 May 2018, 07:37, edited 1 time in total.
alieno75
 
Posts: 135
Joined: 21 Apr 2013, 19:39

Re: Problema con prototipo calcolatrice z80

Postby Just4Fun » 17 Nov 2016, 10:11

Ora hai tutto quello che serve x fare troubleshooting....

Due suggerimenti:

1. quando visualizzi + tracce fai in modo di spostarle in alto o in basso evitando che si sovrappongano..

2. il tuo DSO ha una bellissima interfaccia LAN con la quale puoi "catturare" gli screenshot perfettamente senza fare fotografie + o - sfocate (e anche moolto di +....).... usala.... ;)
User avatar
Just4Fun
 
Posts: 153
Joined: 13 May 2016, 18:17

PreviousNext

Return to Microcontrollori e microprocessori

Who is online

Users browsing this forum: No registered users and 2 guests

cron