Koh Teik Siong wrote: > > Hi Guys: > Thanks for the info you gave me. It help me to solve my problem. I > managed to get the program working in the simulator. > However, when I burn in the program into the PIC17C44, I could not get > the output from PORTD when I changed the input of PORTC!!! Strange! I > wonder if there's anything to do with my way of writing my program. I've > attached my program as a text file and another one is the error text. > Also when I contact up the cct, I grounded both Vss, Vdd to 5V and a > external clock source(programmable one) to osc1. That's all. And, for > the input, it's to the switches.....the output, it's to the LEDS. > That's all... > > ....."The journey of a thousand miles begins with a > small step in the right direction."....... > > ---------------------------- > Name : Koh Teik Siong > Email : tsk196@soton.ac.uk > Tel : +44 (01703) 766255 > Address : Flat 4 Rm 19 > Beechmount House > Beechmount Rd > Bassett > Southampton > SO16 3JD > ----------------------------- > > --------------------------------------------------------------- > ;*********************************************************** > ; DIGITAL TO ANALOG CONVERTER > ; > ; This program converts the digital signal -128 to 127 > ;to give a output voltage of -10V to 10V. This is to control > ;the voltage of the motor so that it can rotate the motor to > ;the desire speed and position. > ; > ;*********************************************************** > > list P=17C44, r=hex > > > > ddrc equ 0x0110 ; I've also tried to use address 0x10 > portc equ 0x0111 ; I've also tried to use address 0x10 > ddrd equ 0x0112 ; I've also tried to use address 0x10 > portd equ 0x0113; I've also tried to use address 0x10 > w equ 0x000A > count equ 0x0020 > > ORG 0x0000 > GOTO START > > START > DELAY macro count > VARIABLE I > I = 0 > WHILE I < count > I += 1 > ENDW > ENDM > > CALL INIT > > LOOP MOVLB 1 > movpf portc,portd ;GET DATA > DELAY 100 ;O/P TO PORTD > GOTO LOOP ; > > INIT MOVLB 1 ;MOVE TO BANK 1 > CLRF portc,1 ;INIT PORTC > setf ddrc,1 ;PORTC IS I/P > > clrF portd,1 ;INIT PORTD > clrf ddrd,1 ;PORTD IS O/P > MOVLB 0 ;MOVE TO BANK 0 > RETURN > END > > --------------------------------------------------------------- > Warning[202] C:\MPLAB\TUTOR\DAC.ASM 37 : Argument out of range. Least significant bits used. > Message[302] C:\MPLAB\TUTOR\DAC.ASM 37 : Register in operand not in bank 0. Ensure that bank bits are correct. > Message[302] C:\MPLAB\TUTOR\DAC.ASM 42 : Register in operand not in bank 0. Ensure that bank bits are correct. > Message[302] C:\MPLAB\TUTOR\DAC.ASM 43 : Register in operand not in bank 0. Ensure that bank bits are correct. > Message[302] C:\MPLAB\TUTOR\DAC.ASM 45 : Register in operand not in bank 0. Ensure that bank bits are correct. > Message[302] C:\MPLAB\TUTOR\DAC.ASM 46 : Register in operand not in bank 0. Ensure that bank bits are correct. -- ....."The journey of a thousand miles begins with a small step in the right direction."....... ---------------------------- Name : Koh Teik Siong Email : tsk196@soton.ac.uk Tel : +44 (01703) 766255 Address : Flat 4 Rm 19 Beechmount House Beechmount Rd Bassett Southampton SO16 3JD ----------------------------- ;*********************************************************** ; DIGITAL TO ANALOG CONVERTER ; ; This program converts the digital signal -128 to 127 ;to give a output voltage of -10V to 10V. This is to control ;the voltage of the motor so that it can rotate the motor to ;the desire speed and position. ; ;*********************************************************** list P=17C44, r=hex ddrc equ 0x0110 ; I've also tried to use address 0x10 portc equ 0x0111 ; I've also tried to use address 0x11 ddrd equ 0x0112 ; I've also tried to use address 0x12 portd equ 0x0113 ; I've also tried to use address 0x13 w equ 0x000A count equ 0x0020 ORG 0x0000 GOTO START START DELAY macro count VARIABLE I I = 0 WHILE I < count I += 1 ENDW ENDM CALL INIT LOOP MOVLB 1 movpf portc,portd ;GET DATA DELAY 100 ;O/P TO PORTD GOTO LOOP ; INIT MOVLB 1 ;MOVE TO BANK 1 CLRF portc,1 ;INIT PORTC setf ddrc,1 ;PORTC IS I/P clrF portd,1 ;INIT PORTD clrf ddrd,1 ;PORTD IS O/P MOVLB 0 ;MOVE TO BANK 0 RETURN END Warning[202] C:\MPLAB\TUTOR\DAC.ASM 37 : Argument out of range. Least significant bits used. Message[302] C:\MPLAB\TUTOR\DAC.ASM 37 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\MPLAB\TUTOR\DAC.ASM 42 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\MPLAB\TUTOR\DAC.ASM 43 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\MPLAB\TUTOR\DAC.ASM 45 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\MPLAB\TUTOR\DAC.ASM 46 : Register in operand not in bank 0. Ensure that bank bits are correct.