>> BTW, it is possible to properly use the RETLW as a lookup table in >> PIC24/dsPIC assembly code. >> mov ,W0 >> bra W0 >> retlw valuefor0 >> retlw valuefor1 >> retlw valuefor2 >> .etc. >> This is significantly slower than using PSV, but is very simple to use. >> >> -- Bob Ammerman >> RAm Systems >It is 3 times slower than PSV (1 CALL + 1 BRA + 1 RETLW =3D 6 cycles >total, against 1 MOVE + 1 Stall =3D 2 cycles total) and uses twice as many >FLASH words. Actually, it isn't quite that bad. Before using data stored in PSV you woul= d have to add the base address of the array: mov , W0 mov #array_base_address_in_psv,W1 mov.b [W1+W0],W0 And this only works for a byte array. For a word array you'd need to scale the index value: mov ,W0 sl W0,#1,W0 mov #array_base_address,W1 mov [W1+W0],W0 Of course RETLW can only handle 10 bit constants, not full word values. >Besides you are forced to use two different access methods, one for >constant data in FLASH and another for data in RAM. True >Isaac --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .