MikroElektronika PIC Microcontrollers PIC16 Ficha de datos Pagina 184

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 194
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 183
Programming PIC Microcontrollers in BASIC - mikroElektronika
external hardware.
BASIC has a library for working with internal EEPROM which makes writing and reading data very
easy. Library function EEPROM_Read reads data from a specified address, while library procedure
EEPROM_Write writes data to the specified address.
Note: Be aware that all interrupts will be disabled during execution of EEPROM_Write routine (GIE
bit of INTCON register will be cleared). Routine will set this bit on exit. Ensure minimum 20ms delay
between successive use of routines EEPROM_Write and EEPROM_Read. Although EEPROM will
write the correct value, EEPROM_Read might return undefined result.
In our following example, we will write a sequence of numbers to successive locations in EEPROM.
Afterwards, we’ll read these and output to PORTB to verify the process.
program EEPROM_test
dim i as byte
dim j as byte
main:
TRISB = 0
for i = 0 to 20
EEPROM_Write(i, i + 6)
next i
Delay_ms(30)
for i = 0 to 20
PORTB = EEPROM_Read(i)
for j = 0 to 200
Delay_us(500)
next j
next i
end.
8.1.2 Serial EEPROM
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/08.htm (2 sur 12)05/11/2004 02:28:29
Vista de pagina 183
1 2 ... 179 180 181 182 183 184 185 186 187 188 189 ... 193 194

Comentarios a estos manuales

Sin comentarios