Code:
; Created by LCDtrigtable360.c Processor 16F877 trig CODE GLOBAL xtable,ytable xtable: DW 0x40 DW 0x40 DW 0x41 DW 0x42 DW 0x43 DW 0x43 DW 0x44 DW 0x45 DW 0x46 DW 0x47 DW 0x47 DW 0x48 DW 0x49 DW 0x4A DW 0x4B DW 0x4B DW 0x4C DW 0x4D DW 0x4E DW 0x4E DW 0x4F DW 0x50 DW 0x51 DW 0x51 DW 0x52 DW 0x53 DW 0x54 DW 0x54 DW 0x55 DW 0x56 DW 0x56 DW 0x57 DW 0x58 DW 0x58 DW 0x59 DW 0x5A DW 0x5A DW 0x5B DW 0x5C DW 0x5C DW 0x5D DW 0x5E DW 0x5E DW 0x5F DW 0x5F DW 0x60 DW 0x60 DW 0x61 DW 0x62 DW 0x62 DW 0x63 DW 0x63 DW 0x64 DW 0x64 DW 0x65 DW 0x65 DW 0x65 DW 0x66 DW 0x66 DW 0x67 DW 0x67 DW 0x68 DW 0x68 DW 0x68 DW 0x69 DW 0x69 DW 0x69 DW 0x6A DW 0x6A DW 0x6A DW 0x6B DW 0x6B DW 0x6B DW 0x6B DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6B DW 0x6B DW 0x6B DW 0x6B DW 0x6A DW 0x6A DW 0x6A DW 0x69 DW 0x69 DW 0x69 DW 0x68 DW 0x68 DW 0x68 DW 0x67 DW 0x67 DW 0x66 DW 0x66 DW 0x65 DW 0x65 DW 0x65 DW 0x64 DW 0x64 DW 0x63 DW 0x63 DW 0x62 DW 0x62 DW 0x61 DW 0x60 DW 0x60 DW 0x5F DW 0x5F DW 0x5E DW 0x5E DW 0x5D DW 0x5C DW 0x5C DW 0x5B DW 0x5A DW 0x5A DW 0x59 DW 0x58 DW 0x58 DW 0x57 DW 0x56 DW 0x56 DW 0x55 DW 0x54 DW 0x54 DW 0x53 DW 0x52 DW 0x51 DW 0x51 DW 0x50 DW 0x4F DW 0x4E DW 0x4E DW 0x4D DW 0x4C DW 0x4B DW 0x4B DW 0x4A DW 0x49 DW 0x48 DW 0x47 DW 0x47 DW 0x46 DW 0x45 DW 0x44 DW 0x43 DW 0x43 DW 0x42 DW 0x41 DW 0x40 DW 0x40 DW 0x3F DW 0x3E DW 0x3D DW 0x3C DW 0x3C DW 0x3B DW 0x3A DW 0x39 DW 0x38 DW 0x38 DW 0x37 DW 0x36 DW 0x35 DW 0x34 DW 0x34 DW 0x33 DW 0x32 DW 0x31 DW 0x31 DW 0x30 DW 0x2F DW 0x2E DW 0x2E DW 0x2D DW 0x2C DW 0x2B DW 0x2B DW 0x2A DW 0x29 DW 0x29 DW 0x28 DW 0x27 DW 0x27 DW 0x26 DW 0x25 DW 0x25 DW 0x24 DW 0x23 DW 0x23 DW 0x22 DW 0x21 DW 0x21 DW 0x20 DW 0x20 DW 0x1F DW 0x1F DW 0x1E DW 0x1D DW 0x1D DW 0x1C DW 0x1C DW 0x1B DW 0x1B DW 0x1A DW 0x1A DW 0x1A DW 0x19 DW 0x19 DW 0x18 DW 0x18 DW 0x17 DW 0x17 DW 0x17 DW 0x16 DW 0x16 DW 0x16 DW 0x15 DW 0x15 DW 0x15 DW 0x14 DW 0x14 DW 0x14 DW 0x14 DW 0x13 DW 0x13 DW 0x13 DW 0x13 DW 0x13 DW 0x13 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x12 DW 0x13 DW 0x13 DW 0x13 DW 0x13 DW 0x13 DW 0x13 DW 0x14 DW 0x14 DW 0x14 DW 0x14 DW 0x15 DW 0x15 DW 0x15 DW 0x16 DW 0x16 DW 0x16 DW 0x17 DW 0x17 DW 0x17 DW 0x18 DW 0x18 DW 0x19 DW 0x19 DW 0x1A DW 0x1A DW 0x1A DW 0x1B DW 0x1B DW 0x1C DW 0x1C DW 0x1D DW 0x1D DW 0x1E DW 0x1F DW 0x1F DW 0x20 DW 0x20 DW 0x21 DW 0x21 DW 0x22 DW 0x23 DW 0x23 DW 0x24 DW 0x25 DW 0x25 DW 0x26 DW 0x27 DW 0x27 DW 0x28 DW 0x29 DW 0x29 DW 0x2A DW 0x2B DW 0x2B DW 0x2C DW 0x2D DW 0x2E DW 0x2E DW 0x2F DW 0x30 DW 0x31 DW 0x31 DW 0x32 DW 0x33 DW 0x34 DW 0x34 DW 0x35 DW 0x36 DW 0x37 DW 0x38 DW 0x38 DW 0x39 DW 0x3A DW 0x3B DW 0x3C DW 0x3C DW 0x3D DW 0x3E DW 0x3F DW 0x3F DW 0x40 DW 0x41 DW 0x42 DW 0x43 DW 0x43 DW 0x44 DW 0x45 DW 0x46 DW 0x47 DW 0x47 DW 0x48 DW 0x49 DW 0x4A DW 0x4B DW 0x4B DW 0x4C DW 0x4D DW 0x4E DW 0x4E DW 0x4F DW 0x50 DW 0x51 DW 0x51 DW 0x52 DW 0x53 DW 0x54 DW 0x54 DW 0x55 DW 0x56 DW 0x56 DW 0x57 DW 0x58 DW 0x58 DW 0x59 DW 0x5A DW 0x5A DW 0x5B DW 0x5C DW 0x5C DW 0x5D DW 0x5E DW 0x5E DW 0x5F DW 0x5F DW 0x60 DW 0x60 DW 0x61 DW 0x62 DW 0x62 DW 0x63 DW 0x63 DW 0x64 DW 0x64 DW 0x65 DW 0x65 DW 0x65 DW 0x66 DW 0x66 DW 0x67 DW 0x67 DW 0x68 DW 0x68 DW 0x68 DW 0x69 DW 0x69 DW 0x69 DW 0x6A DW 0x6A DW 0x6A DW 0x6B DW 0x6B DW 0x6B DW 0x6B DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6C DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D DW 0x6D ytable: DW 0x20 DW 0x20 DW 0x21 DW 0x21 DW 0x22 DW 0x22 DW 0x23 DW 0x23 DW 0x24 DW 0x24 DW 0x25 DW 0x25 DW 0x26 DW 0x26 DW 0x27 DW 0x28 DW 0x28 DW 0x29 DW 0x29 DW 0x2A DW 0x2A DW 0x2B DW 0x2B DW 0x2C DW 0x2C DW 0x2D DW 0x2D DW 0x2E DW 0x2E DW 0x2F DW 0x2F DW 0x2F DW 0x30 DW 0x30 DW 0x31 DW 0x31 DW 0x32 DW 0x32 DW 0x33 DW 0x33 DW 0x33 DW 0x34 DW 0x34 DW 0x35 DW 0x35 DW 0x35 DW 0x36 DW 0x36 DW 0x37 DW 0x37 DW 0x37 DW 0x38 DW 0x38 DW 0x38 DW 0x39 DW 0x39 DW 0x39 DW 0x39 DW 0x3A DW 0x3A DW 0x3A DW 0x3B DW 0x3B DW 0x3B DW 0x3B DW 0x3C DW 0x3C DW 0x3C DW 0x3C DW 0x3C DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3F DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3C DW 0x3C DW 0x3C DW 0x3C DW 0x3C DW 0x3B DW 0x3B DW 0x3B DW 0x3B DW 0x3A DW 0x3A DW 0x3A DW 0x39 DW 0x39 DW 0x39 DW 0x39 DW 0x38 DW 0x38 DW 0x38 DW 0x37 DW 0x37 DW 0x37 DW 0x36 DW 0x36 DW 0x35 DW 0x35 DW 0x35 DW 0x34 DW 0x34 DW 0x33 DW 0x33 DW 0x33 DW 0x32 DW 0x32 DW 0x31 DW 0x31 DW 0x30 DW 0x30 DW 0x2F DW 0x2F DW 0x2F DW 0x2E DW 0x2E DW 0x2D DW 0x2D DW 0x2C DW 0x2C DW 0x2B DW 0x2B DW 0x2A DW 0x2A DW 0x29 DW 0x29 DW 0x28 DW 0x28 DW 0x27 DW 0x26 DW 0x26 DW 0x25 DW 0x25 DW 0x24 DW 0x24 DW 0x23 DW 0x23 DW 0x22 DW 0x22 DW 0x21 DW 0x21 DW 0x20 DW 0x20 DW 0x1F DW 0x1E DW 0x1E DW 0x1D DW 0x1D DW 0x1C DW 0x1C DW 0x1B DW 0x1B DW 0x1A DW 0x1A DW 0x19 DW 0x19 DW 0x18 DW 0x17 DW 0x17 DW 0x16 DW 0x16 DW 0x15 DW 0x15 DW 0x14 DW 0x14 DW 0x13 DW 0x13 DW 0x12 DW 0x12 DW 0x11 DW 0x11 DW 0x10 DW 0x10 DW 0x10 DW 0x0F DW 0x0F DW 0x0E DW 0x0E DW 0x0D DW 0x0D DW 0x0C DW 0x0C DW 0x0C DW 0x0B DW 0x0B DW 0x0A DW 0x0A DW 0x0A DW 0x09 DW 0x09 DW 0x08 DW 0x08 DW 0x08 DW 0x07 DW 0x07 DW 0x07 DW 0x06 DW 0x06 DW 0x06 DW 0x06 DW 0x05 DW 0x05 DW 0x05 DW 0x04 DW 0x04 DW 0x04 DW 0x04 DW 0x03 DW 0x03 DW 0x03 DW 0x03 DW 0x03 DW 0x02 DW 0x02 DW 0x02 DW 0x02 DW 0x02 DW 0x02 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x01 DW 0x02 DW 0x02 DW 0x02 DW 0x02 DW 0x02 DW 0x02 DW 0x03 DW 0x03 DW 0x03 DW 0x03 DW 0x03 DW 0x04 DW 0x04 DW 0x04 DW 0x04 DW 0x05 DW 0x05 DW 0x05 DW 0x06 DW 0x06 DW 0x06 DW 0x06 DW 0x07 DW 0x07 DW 0x07 DW 0x08 DW 0x08 DW 0x08 DW 0x09 DW 0x09 DW 0x0A DW 0x0A DW 0x0A DW 0x0B DW 0x0B DW 0x0C DW 0x0C DW 0x0C DW 0x0D DW 0x0D DW 0x0E DW 0x0E DW 0x0F DW 0x0F DW 0x10 DW 0x10 DW 0x10 DW 0x11 DW 0x11 DW 0x12 DW 0x12 DW 0x13 DW 0x13 DW 0x14 DW 0x14 DW 0x15 DW 0x15 DW 0x16 DW 0x16 DW 0x17 DW 0x17 DW 0x18 DW 0x19 DW 0x19 DW 0x1A DW 0x1A DW 0x1B DW 0x1B DW 0x1C DW 0x1C DW 0x1D DW 0x1D DW 0x1E DW 0x1E DW 0x1F DW 0x1F DW 0x20 DW 0x21 DW 0x21 DW 0x22 DW 0x22 DW 0x23 DW 0x23 DW 0x24 DW 0x24 DW 0x25 DW 0x25 DW 0x26 DW 0x26 DW 0x27 DW 0x28 DW 0x28 DW 0x29 DW 0x29 DW 0x2A DW 0x2A DW 0x2B DW 0x2B DW 0x2C DW 0x2C DW 0x2D DW 0x2D DW 0x2E DW 0x2E DW 0x2F DW 0x2F DW 0x2F DW 0x30 DW 0x30 DW 0x31 DW 0x31 DW 0x32 DW 0x32 DW 0x33 DW 0x33 DW 0x33 DW 0x34 DW 0x34 DW 0x35 DW 0x35 DW 0x35 DW 0x36 DW 0x36 DW 0x37 DW 0x37 DW 0x37 DW 0x38 DW 0x38 DW 0x38 DW 0x39 DW 0x39 DW 0x39 DW 0x39 DW 0x3A DW 0x3A DW 0x3A DW 0x3B DW 0x3B DW 0x3B DW 0x3B DW 0x3C DW 0x3C DW 0x3C DW 0x3C DW 0x3C DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3D DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3E DW 0x3F END+
+Processor 16F877 Radix DEC EXPAND include "p16f877.inc" EXTERN initGRLCD,clearLCD,linedraw EXTERN x1,y1,x2,y2 EXTERN xtable,ytable shared UDATA_SHR FSR_TEMP res 1 W_TEMP res 1 STATUS_TEMP res 1 scratch1 res 1 ; work space scratch2 res 1 scratch3 res 1 scratch4 res 1 scratch5 res 1 GLOBAL scratch1,scratch2,scratch3 UDATA count res 1 xx res 1 yy res 1 angleL res 1 angleH res 1 _ResetVector set 0x00 ORG _ResetVector movlw high Start movwf PCLATH goto Start application CODE Start: pagesel initGRLCD call initGRLCD pagesel clearLCD call clearLCD movlw 0x0 movwf xx movlw 0x3F movwf yy movlw 21 movwf count loop: movf xx,W movwf scratch1 movf yy,W movwf scratch2 banksel x1 movlw 0 movwf x1 movf scratch2,W movwf y1 movf scratch1,W movwf x2 movlw 0x0 movwf y2 pagesel linedraw call linedraw banksel xx movlw 6 addwf xx,F movlw 3 subwf yy,F clrf scratch1 clrf scratch2 movlw 0x1 movwf scratch3 decfsz scratch1,F goto $-1 decfsz scratch2,F goto $-3 decfsz scratch3,F goto $-5 decfsz count,F goto loop pagesel clearLCD call clearLCD loop3: banksel angleL clrf angleL clrf angleH movlw 60 movwf count loop2: pagesel clearLCD call clearLCD pagesel $ banksel x1 movlw 0x40 movwf x1 movlw 0x20 movwf y1 call xsinlookup banksel x2 andlw 0x7F movwf x2 call ycoslookup banksel y2 andlw 0x3F movwf y2 pagesel linedraw call linedraw pagesel $ clrf scratch1 clrf scratch2 movlw 0x4 movwf scratch3 decfsz scratch1,F goto $-1 decfsz scratch2,F goto $-3 decfsz scratch3,F goto $-5 banksel angleL movlw 6 addwf angleL,F btfsc STATUS,C incf angleH,F decfsz count,F goto loop2 goto loop3 commonlook: banksel EEADRH movwf EEADRH movf scratch1,W banksel EEADR movwf EEADR banksel EECON1 bsf EECON1 & 0x7F,EEPGD bsf EECON1 & 0x7F,RD nop nop banksel EEDATA movf EEDATA,W banksel angleL return xsinlookup: banksel angleL movf angleL,W addlw low xtable movwf scratch1 movlw high xtable btfsc STATUS,C addlw 1 addwf angleH,W goto commonlook xcoslookup: banksel angleL clrf scratch2 movf angleL,W addlw 90 movwf scratch1 btfsc STATUS,C incf scratch2,F addlw low xtable movwf scratch1 btfsc STATUS,C incf scratch2,F movlw high xtable addwf scratch2,W addwf angleH,W goto commonlook ysinlookup: banksel angleL movf angleL,W addlw low ytable movwf scratch1 movlw high ytable btfsc STATUS,C addlw 1 addwf angleH,W goto commonlook ycoslookup banksel angleL clrf scratch2 movf angleL,W addlw 90 movwf scratch1 btfsc STATUS,C incf scratch2,F addlw low ytable movwf scratch1 btfsc STATUS,C incf scratch2,F movlw high ytable addwf scratch2,W addwf angleH,W goto commonlook END
file: /Techref/member/peter_Oonion-bt-/linedemo.htm, 12KB, , updated: 2005/6/3 15:33, local time: 2024/11/21 23:00,
owner: peter_Oonion-bt-,
18.118.227.199:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/member/peter_Oonion-bt-/linedemo.htm"> Here is a bit of demo code that uses the linedraw </A> |
Did you find what you needed? |