11.07.2015 Views

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>PICBASIC</strong> <strong>PLUS</strong> Compiler5.8. CDATASyntax : CDATA { alphanumeric data }Overview :Operators :Place information directly into memory for access by CREAD andCWRITE.alphanumeric data can be any alphabetic character or string enclosedin quotes (“) or numeric data without quotes.Example : DEVICE 16F877 ‘ Use a 16F877 PICDIM Var as BYTEVar = CREAD 2000 ‘ Read the data from address 2000ORG 2000‘ Set the address of the CDATA commandCDATA 120 ‘ Place 120 at address 2000In the above example, the data is located at address 2000 within thePIC, then it’s read using the CREAD command.Notes :CDATA is only available on the newer PIC types that have selfmodifyingfeatures, such as the 16F87x range.In order for the CREAD and CWRITE commands to locate the data inmemory, CDATA commands should be preceded by an ORG directive.ORG 4000 ‘ Move the address pointer to 4000CDATA “Hello World” , 16200 , 253 ‘ Place the data at address 4000The above example, places the data “Hello World” at address 4000within the PIC. You must make sure that this area is not being usedby your program. This can be done by examining the last address inthe HEX window.An alternative, and I think better, method for locating the address ofthe CDATA table is by using a small ASM routine: -DIM Lab_Addr as WORD' Get the address of CDATA LABEL into variable Lab_Addr@ Movlw High Table ; Get hi address of tableWreg_Byte Lab_AddrH ; Place into Variable@ Movlw Low Table ; Get lo address of tableWreg_Byte Lab_Addr ; Place into Variable{ rest of code }Table:- CDATA { list of values }By placing the above code at the top of a program, the CDATA’s addressis now held in the variable LAB_ADDR.34Copyright Crownhill 2001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!