True, movff is a ram (or memory mapped I/O) to ram move, but the arguments are the addresses of what to move, not a literal. I don't think there's a movlf instruction that would move a literal into ram. I think you have to go through w... Harold > > Harold, > > > Your suggestion surely should work, but the movff instruction is a > register to register insruction, > So it should move the contents of 'farf' into 'test' without going > through 'w'. At least in theory. > > Regards, > > Jim > > > -----Original Message----- > From: piclist-bounces@MIT.EDU [mailto:piclist-bounces@MIT.EDU] On Behalf > Of Harold Hallikainen > Sent: Friday, December 15, 2006 2:17 PM > To: Microcontroller discussion list - Public. > Subject: Re: [PIC] MPLAB sim mode...#defines dont work? > > >> Since I dont have my target hardware here, I write and test the code >> in the simulation mode. I thought, having a #define would work to set > >> a value for a variable but it doesn't seem to be working. For example >> >> #define farf d'5' >> >> when I go do a >> >> movff farf,test >> >> test just gets 0x00 >> >> So i did >> >> movf farf,w >> >> and WREG gets zero (least its consistant) >> >> I'll try it again when I have hardware to watch in the debugger, but > >> curious is it because there really isnt hardware, the #define doesn't >> store? Figured it would just stick it in ram someplace > > > It looks like you're putting the contents of location 5 into test and > into w. If you want to put a 5 in test or w, do something like this: > > movlw farf > movwf test > > Harold > -- > FCC Rules Updated Daily at http://www.hallikainen.com - Advertising > opportunities available! > -- > http://www.piclist.com PIC/SX FAQ & list archive View/change your > membership options at http://mailman.mit.edu/mailman/listinfo/piclist > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist