Jump to content

george

Members
  • Content Count

    2
  • Joined

  • Last visited

    Never

Community Reputation

0 Neutral

About george

  • Rank
    Newbrie
  1. george

    eeprom demo

    Hi all, first error is in name of function. This function don't write to flash but to eeprom. Flash is used for program. So, I have to add one line to correct this function. char read_flash( char addr ) { //Read flash eeadr = addr; clear_bit( eecon1, EEPGD ); //!!!!!!!! see Microchips docs set_bit( eecon1, RD ); asm movf _eedata, W } Hi George
  2. Hi, I have problems with my project. I have some assembler routines and I want to use them in my C-project. One way is in-line assembler, but in this case compiler is very stupid. See this: ;;;;;;;;asm{ ;;;;;;;; BCF STATUS, 0x0006 ;;;;;;;; BCF STATUS, 0x0005 ; Bank 0 ;;;;;;;; bsf PORTB,5 ;LED ;network activity LED ;;;;;;;; movlw _INBUFFER ;;;;;;;; movwf FSR ;;;;;;;; movlw 0FH ;;;;;;;; movwf _COUNTER ;;;;;;;; bcf STATUS,0x0000 ;;;;;;;; clrwdt ;;;;;;;; clrwdt ;;;;;;;; ;;;;;;;; ;;;;;;;;} bcf STATUS, RP0 bcf STATUS, RP1 BCF STATUS, 0x0006 BCF STATUS, 0x0005 ; Bank 0 bsf PORTB,5 ;LED ;network activity LED movlw _INBUFFER movwf FSR movlw 0FH movwf _COUNTER bcf STATUS,0x0000 clrwdt clrwdt First two lines sets memory bank to 0. Compiler, becase next instruction use PORTB in bank 0 !!adds!! same instructions again. Also when calling subrutine, instructions for handling PCLATH are added. I have assembler rutine for right timing of my application (an communication application), but this destroys my code and timing. So, is there an way how to link more modules (assembler and C) together and is there an way how to set assembler code to specified memory area? (typically, I want to write assembler rutine for interrupt ORG 4 .............. retfie)
×
×
  • Create New...