Intel 386EXTC hardware interrupt programming

Hi, I am working on a PCB with Intel 80386EXTC embedded processor and programming in assembly. The Flash is programmed with .COM and a peripheral device is connected to INT0 pin of processor.

;The processor works in real mode. and it can access only 64MB of memory. Is it correct to memory map Flash in this region 3FF 0000H-3FF FFFFH?

;There are internal peripheral registers that need to be programmed

;At power-on, processor goes to address 3FF FFF0h. Since Flash is only

64Kx8 it goes to location FFF0H of Flash and fetches a JMP instruction.

;When Flash is programmed , even without sending a hardware interrupt at INT0 pin, the program goes to ISR and turns on the LEDs.

;If I decomment the JMP Level1 loop then it never gets out of that loop.

;Can someone suggest what is wrong? Is it that I not mapping the memories correctly? Is it possible that interrupt service procedure may be wrong.

;I am new to x86 assembly and any help is appreciated.

Thanks Learner

.model LARGE .386 .CODE MAIN PROC JMP START ORG 0200H START:

MOV DX, 0F438H ;UCSADL register(F438) MOV AX, 050FH ;ADDED 15 WAIT STATES TO FLASH... OUT DX, AX

MOV DX, 0F43AH ;UCSADH (F43A) DEFINE UCS MEMORY REGION MOV AX, 03FFH ;FLASH FROM 3FF 0000H-3FF FFFFH OUT DX, AX

MOV DX, 0F43CH ;UCSMSKL (FC01) MOV AX, 0FC01H OUT DX, AX

MOV DX, 0F43EH ;UCSMKSKH (F43E) MOV AX, 00H OUT DX, AX

MOV DX, 0F400H ;DEFINE SRAM CHIP SELECT CS0 MOV AX, 010FH ;SRAM FROM 000 0000H - 000 7FFFH OUT DX, AX

MOV DX, 0F402H MOV AX, 00H OUT DX, AX

MOV DX, 0F404H MOV AX, 07C01H OUT DX, AX

MOV DX, 0F406H MOV AX, 00H OUT DX, AX

MOV DX, 0F822H ;PORT 2 SELECT CS0 MOV AX, 01H ;CONFIGURE PORT 2 BIT 0 TO CONNECT CS0 TO PACAKGE OUT DX, AL

MOV DX, 0F820H ;ENABLE PORT 1 AS OUTPUT (REGISTER P1CFG) MOV AX, 00H OUT DX, AX

MOV DX, 0F864H ;PORT 1 AS OUTPUT (P1DIR) MOV AX, 00H OUT DX, AX

MOV AX, 00H ;DEFINE STACK STARTING AT (000 0300H) MOV DS, AX MOV SS, AX MOV SP, 300H

MOV DX, 0F824H ;PORT 3 P3CFG(to select INT0 ) MOV AX, 04H OUT DX, AL

MOV DX, 0F020H ;(ICW1) edge triger mode MOV AX, 11H OUT DX, AL

MOV DX, 0F021H ;ICW2 BASE INTERRUPT VECTOR MOV AX, 20H ;USER INTERRUPT 20H OUT DX, AL

MOV AL, 00H ;ICW3 nO SLAVES CONNECTED OUT DX, AL

MOV AL, 03H ;ICW4 enable AEOI OUT DX, AL

MOV DX, 0F021H ;OCW1 (Enable IR1 to which INT0 is connected) MOV AX, 0FDH OUT DX, AL

MOV DS:[0080H], offset ledon ;VECTOR ADDRESS FOR 20H IS 80H MOV AX,0F000H MOV DS:[0082H], AX

;LEVEL1: MOV AX, 0FH ;TURN ON 4 LEDS as 10101010 ; MOV DX, 0F862h ; OUT DX, AL ; JMP LEVEL1

org 0FFF0h

MOV AX, 08000H ; Enable expanded I/O space OUT 23H, AL ; and unlock the re-map bits XCHG AL, AH OUT 22H, AL OUT 22H, AX

JMP START

MAIN ENDP

;Interrupt service proedure starts at location 0500H in the Flash

org 0500h

ledon proc far

PUSH AX PUSH DX PUSH BX PUSH DS

MOV AX, 0AAH ;TURN ON 4 LEDS as 10101010 MOV DX, 0F862h ;0f862 is the register that contains data ;to be sent to output port 1 OUT DX, AL

POP DS POP BX POP DX POP AX

IRET

ledon endp

Reply to
sonalsingh28
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.