ON 20080207@11:58:20 AM at page: http://techref.massmind.org/techref/microchip/countelapsed.htm# James Newton[JMN-EFP-786] edited the page. Difference: http://techref.massmind.org/techref/diff.asp?url=H:\techref\microchip\countelapsed.htm&version=5 ON 20080207@12:01:52 PM at page: http://techref.massmind.org/techref/microchip/countelapsed.htm#38671.5298148148 James Newton[JMN-EFP-786] Replied to post 38671.5298148148 |Insert 'Please understand: I am not the author of the code. His email address is listed at the top of the page. I have no hope of translating this from Solvinian to English. If you want "the English version" please try to find a translator or contact the author and pay him for the translation. Please do not repeatedly ask for me to provide a translation.' at: '' By the way, could you proide the english comments, please ? I'm newbie, and there seems to be an error in the code. So I'd like to search it for myself, but with english comments, it would be much more easy for me. Thks ! (David from belgium) ON 20080207@12:04:01 PM at page: http://techref.massmind.org/techref/microchip/countelapsed.htm# James Newton[JMN-EFP-786] edited the page. Difference: http://techref.massmind.org/techref/diff.asp?url=H:\techref\microchip\countelapsed.htm&version=9 ON 20080207@12:04:22 PM at page: http://www.piclist.com/microchip/devices.htm#39484.3029050926 James Newton[JMN-EFP-786] removed post 39484.3029050926 |Delete ' Hello, im in the strange country Bulgaria :) and i dont have a lot of Information Sources :( please let some one targeted a little more info about PIC 16F88
  • ' ON 20080209@2:26:59 AM at page: http://www.piclist.com/techref/microchip/pwmmult-sd.htm#39487.1020717593 kyoji anekawa nonomura[kan-MMM-UA4] Questions: Hello,
    Scott Dattalo.

    hello that the master of PIC and stepper does not consider.
    I do not understand English well.
    I cannot understand your "Pulse Width Modulation" well.
    "Probably are not there a more detailed explanation and illustration by my lack of English ability?"

    Thank you. ON 20080211@3:37:47 PM at page: http://www.piclist.com/techref/microchip/pwmmult-sd.htm#39487.1020717593 James Newton[JMN-EFP-786] removed post 39487.1020717593 |Delete 'kyoji anekawa nonomura of MNTECLAB asks:
    Hello,
    Scott Dattalo.

    hello that the master of PIC and stepper does not consider.
    I do not understand English well.
    I cannot understand your "Pulse Width Modulation" well.
    "Probably are not there a more detailed explanation and illustration by my lack of English ability?"

    Thank you.
  • ' ON 20080215@5:39:11 PM at page: http://www.piclist.com/microchip/languages.htm#39491.3945486111 James Newton[JMN-EFP-786] published post 39491.3945486111 jamie@i-technologyinc.com asks:
    Looking for older compiler for some old PIC source that needs a like updating. It is a sturctured type of assembly language called "mc macroassembler". This program was developed by "Microtec Research" and "AMD" back in the eary 1990's. "Microtec Research" is long gone as brough by "Methor Graphics" in 1995. I have some of the pieces need to compile the source but not all.

    Do you have the "MC macroassembler" by "Microtec Research" used to compile this source ?
    |Delete 'P-' before: '' but after: 'Simplified PicKit2 clone for hobby use" ON 20080219@12:49:11 PM at page: http://www.piclist.com/techref/microchip/i2c.htm#39497.5341435185 Mikhail Efroimson[ME-MPS-144] Questions: I'm trying to program a PIC16F886 as a I2C slave device using the code from Microchip application note AN734. I've compiled this example source code using MPLab 7.6 and flashed my PICmicro with the image. Now I am trying to talk to the chip using the AARDVARK I2C/SPI TOTAL PHASE connector but am not able to establish communication. I am trying to write bytes to the slave address from the AARDVARK GUI. I have the SCL, SDA and GND pins of the PICmicro connected to the AARDVARK connector which theoretically should be enough for two way communication via the GUI but it is not working. I've tried writing different numbers of bytes and changing the bitrate. Perhaps the buffer size needs to be adjusted for the PIC16F886. The code is as follows: ; Include Files #include ; Constant Definitions #define NODE_ADDR 0x02 ; Buffer Length Definition #define RX_BUF_LEN 32 ; Variable declarations udata WREGsave res 1 STATUSsave res 1 FSRsave res 1 PCLATHsave res 1 Index res 1 ; Index to receive buffer Temp res 1 ; RXBuffer res RX_BUF_LEN ; Holds rec'd bytes from master device. ; Vectors START code nop goto Startup nop ; 0x0002 nop ; 0x0003 goto ISR ; 0x0004 PROG code ; Macros memset macro Buf_addr,Value,Length movlw Length ; This macro loads a range of data memory movwf Temp ; with a specified value. The starting movlw Buf_addr ; address and number of bytes are also movwf FSR ; specified. SetNext movlw 40 movwf INDF incf FSR, F decfsz Temp, F goto SetNext endm LFSR macro Address, Offset ; This macro loads the correct value movlw Address ; into the FSR given an initial data movwf FSR ; memory address and offset value. movf Offset, W addwf FSR, F endm ; Main Code Startup bcf STATUS, RP1 bcf STATUS, RP0 Main clrwdt ; Clear the watchdog timer. goto Main ; Loop forever. ; Interrupt Code ISR movwf WREGsave ; Save WREG movf STATUS, W ; Get STATUS register banksel STATUSsave ; Switch banks, if needed. movwf STATUSsave ; Save the STATUS register movf PCLATH, W ; movwf PCLATHsave ; Save PCLATH movf FSR, W ; movwf FSRsave ; Save FSR banksel PIR1 btfss PIR1, SSPIF ; Is this a SSP interrupt? goto $ ; No, just trap here. bcf PIR1, SSPIF ; call SSP_Handler ; Yes, service SSP interrupt banksel FSRsave movf FSRsave movwf FSR ; Restore FSR movf PCLATHsave, W ; movwf PCLATH ; Restore PCLATH movf STATUSsave, W ; movwf STATUS ; Restore STATUS swapf WREGsave, F ; swapf WREGsave, W ; Restore WREG retfile ; Return from interrupt. Setup ; Initializes program variables and peripheral registers. banksel PCON bsf PCON, NOT_POR bsf PCON, NOT_BOR banksel Index ; Clear various program variables clrf Index clrf PORTB clrf PIR1 banksel TRISB clrf TRISB movlw 0x36 ; Setup SSP module for 7-bit banksel SSPCON movwf SSPCON ; address, slave mode movlw NODE_ADDR banksel SSPADD movwf SSPADD clrf SSPADD banksel PIE1 bsf PIE1, SSPIE bsf INTCON, PEIE ; Enable all peripheral interupts bsf INTCON, GIE ; Enable global interrupts bcf STATUS, RP0 return SSP_Handler banksel SSPSTAT movf SSPSTAT, W ; Get the value of SSPSTAT andlw b'00101101' ; Mask out unimportant bits in SSPSTAT banksel Temp ; Put masked value in Temp movwf Temp ; for comparison checking. State1: ; Write operation, last byte was an movlw b'00001001' ; address, buffer is full. xorwf Temp, W ; btfss STATUS, Z ; Are we in State1? goto State2 ; No, check for next state..... memset RXBuffer, O, RX_BUF_LEN ; Clear the receive buffer. clrf Index ; Clear the buffer index call ReadI2C ; Do a dummy read of the SSPBUF return State2: ; Write operation, last byte was data movlw b'00101001' ; buffer is full. xorwf Temp, W btfss STATUS, Z ; Are we in State2? goto State3 ; No, check for next state..... LFSR RXBuffer, Index ; Point to the buffer. call ReadI2C ; Get the byte from the SSP. movwf INDF ; Put it in the buffer. incf Index, F ; Increment the buffer pointer movf Index, F ; Increment the buffer index return State3: ; Read operation, last byte was an movlw b'00001100' ; address, buffer is empty. xorwf Temp, W btfss STATUS, Z ; Are we in State3? goto State4 ; No, check for next state..... clrf Index ; clear the buffer index. LFSR RXBuffer, Index ; Point to the buffer movf INDF, W ; Get the byte to SSPBUF call WriteI2C ; Write the byte to SSPBUF incf Index, F ; Increment the buffer index. return State4: ; Read operation, last byte was data, movlw b'00101100' ; buffer is empty. xorwf Temp, W btfss STATUS, Z ; Are we in State4? goto State5 ; No, check for next state..... movf Index, W ; Get the current buffer index. sublw RX_BUF_LEN ; Subtract the buffer length. btfsc STATUS, Z ; Has the index exceeded the buffer length? clrf Index ; Yes, clear the buffer index. LFSR RXBuffer, Index ; Point to the buffer movf INDF, W ; Get the byte call WriteI2C ; Write to SSPBUF incf Index, F ; Increment the buffer index. return State5: movlw b'00101000' ; A NACK was received when transmitting xorwf Temp, W ; data back from the master. Slave logic btfss STATUS, Z ; is reset in this case. R_W = 0, D_A = 1 goto I2CErr ; and BF = 0 return I2CErr nop banksel PORTB ; Something went wrong! Set LED bsf PORTB, 7 ; and loop forever. WDT will reset goto $ ; device, if enabled. return WriteI2C banksel SSPSTAT btfsc SSPSTAT, BF ; Is the buffer full? goto WriteI2C ; Yes, keep waiting banksel SSPCON ; No, continue. DoI2CWrite bcf SSPCON,WCOL ; Clear the WCOL flag movwf SSPBUF ; Write the byte in WREG btfsc SSPCON,WCOL ; Was there a write collision? goto DoI2CWrite bsf SSPCON, CKP ; Release the clock. return ReadI2C banksel SSPBUF movf SSPBUF,W ; Get the byte and put in WREG return end ; End of file end If somebody can please point me in the right direction, it would be greatly appreciated. Thank you, ~Mikhail ON 20080219@5:35:50 PM at page: http://www.piclist.com/techref/microchip/i2c.htm#39497.5341435185 James Newton[JMN-EFP-786] removed post 39497.5341435185 with comment: 'I've reposted this to the mailing list (see piclist.com) as you have a better chance of getting an answer that way.' |Delete 'Mikhail Efroimson of Murata Power Solutions asks:
    I'm trying to program a PIC16F886 as a I2C slave device using the code from Microchip application note AN734. I've compiled this example source code using MPLab 7.6 and flashed my PICmicro with the image. Now I am trying to talk to the chip using the AARDVARK I2C/SPI TOTAL PHASE connector but am not able to establish communication. I am trying to write bytes to the slave address from the AARDVARK GUI. I have the SCL, SDA and GND pins of the PICmicro connected to the AARDVARK connector which theoretically should be enough for two way communication via the GUI but it is not working. I've tried writing different numbers of bytes and changing the bitrate. Perhaps the buffer size needs to be adjusted for the PIC16F886. The code is as follows: ; Include Files #include ; Constant Definitions #define NODE_ADDR 0x02 ; Buffer Length Definition #define RX_BUF_LEN 32 ; Variable declarations udata WREGsave res 1 STATUSsave res 1 FSRsave res 1 PCLATHsave res 1 Index res 1 ; Index to receive buffer Temp res 1 ; RXBuffer res RX_BUF_LEN ; Holds rec'd bytes from master device. ; Vectors START code nop goto Startup nop ; 0x0002 nop ; 0x0003 goto ISR ; 0x0004 PROG code ; Macros memset macro Buf_addr,Value,Length movlw Length ; This macro loads a range of data memory movwf Temp ; with a specified value. The starting movlw Buf_addr ; address and number of bytes are also movwf FSR ; specified. SetNext movlw 40 movwf INDF incf FSR, F decfsz Temp, F goto SetNext endm LFSR macro Address, Offset ; This macro loads the correct value movlw Address ; into the FSR given an initial data movwf FSR ; memory address and offset value. movf Offset, W addwf FSR, F endm ; Main Code Startup bcf STATUS, RP1 bcf STATUS, RP0 Main clrwdt ; Clear the watchdog timer. goto Main ; Loop forever. ; Interrupt Code ISR movwf WREGsave ; Save WREG movf STATUS, W ; Get STATUS register banksel STATUSsave ; Switch banks, if needed. movwf STATUSsave ; Save the STATUS register movf PCLATH, W ; movwf PCLATHsave ; Save PCLATH movf FSR, W ; movwf FSRsave ; Save FSR banksel PIR1 btfss PIR1, SSPIF ; Is this a SSP interrupt? goto $ ; No, just trap here. bcf PIR1, SSPIF ; call SSP_Handler ; Yes, service SSP interrupt banksel FSRsave movf FSRsave movwf FSR ; Restore FSR movf PCLATHsave, W ; movwf PCLATH ; Restore PCLATH movf STATUSsave, W ; movwf STATUS ; Restore STATUS swapf WREGsave, F ; swapf WREGsave, W ; Restore WREG retfile ; Return from interrupt. Setup ; Initializes program variables and peripheral registers. banksel PCON bsf PCON, NOT_POR bsf PCON, NOT_BOR banksel Index ; Clear various program variables clrf Index clrf PORTB clrf PIR1 banksel TRISB clrf TRISB movlw 0x36 ; Setup SSP module for 7-bit banksel SSPCON movwf SSPCON ; address, slave mode movlw NODE_ADDR banksel SSPADD movwf SSPADD clrf SSPADD banksel PIE1 bsf PIE1, SSPIE bsf INTCON, PEIE ; Enable all peripheral interupts bsf INTCON, GIE ; Enable global interrupts bcf STATUS, RP0 return SSP_Handler banksel SSPSTAT movf SSPSTAT, W ; Get the value of SSPSTAT andlw b'00101101' ; Mask out unimportant bits in SSPSTAT banksel Temp ; Put masked value in Temp movwf Temp ; for comparison checking. State1: ; Write operation, last byte was an movlw b'00001001' ; address, buffer is full. xorwf Temp, W ; btfss STATUS, Z ; Are we in State1? goto State2 ; No, check for next state..... memset RXBuffer, O, RX_BUF_LEN ; Clear the receive buffer. clrf Index ; Clear the buffer index call ReadI2C ; Do a dummy read of the SSPBUF return State2: ; Write operation, last byte was data movlw b'00101001' ; buffer is full. xorwf Temp, W btfss STATUS, Z ; Are we in State2? goto State3 ; No, check for next state..... LFSR RXBuffer, Index ; Point to the buffer. call ReadI2C ; Get the byte from the SSP. movwf INDF ; Put it in the buffer. incf Index, F ; Increment the buffer pointer movf Index, F ; Increment the buffer index return State3: ; Read operation, last byte was an movlw b'00001100' ; address, buffer is empty. xorwf Temp, W btfss STATUS, Z ; Are we in State3? goto State4 ; No, check for next state..... clrf Index ; clear the buffer index. LFSR RXBuffer, Index ; Point to the buffer movf INDF, W ; Get the byte to SSPBUF call WriteI2C ; Write the byte to SSPBUF incf Index, F ; Increment the buffer index. return State4: ; Read operation, last byte was data, movlw b'00101100' ; buffer is empty. xorwf Temp, W btfss STATUS, Z ; Are we in State4? goto State5 ; No, check for next state..... movf Index, W ; Get the current buffer index. sublw RX_BUF_LEN ; Subtract the buffer length. btfsc STATUS, Z ; Has the index exceeded the buffer length? clrf Index ; Yes, clear the buffer index. LFSR RXBuffer, Index ; Point to the buffer movf INDF, W ; Get the byte call WriteI2C ; Write to SSPBUF incf Index, F ; Increment the buffer index. return State5: movlw b'00101000' ; A NACK was received when transmitting xorwf Temp, W ; data back from the master. Slave logic btfss STATUS, Z ; is reset in this case. R_W = 0, D_A = 1 goto I2CErr ; and BF = 0 return I2CErr nop banksel PORTB ; Something went wrong! Set LED bsf PORTB, 7 ; and loop forever. WDT will reset goto $ ; device, if enabled. return WriteI2C banksel SSPSTAT btfsc SSPSTAT, BF ; Is the buffer full? goto WriteI2C ; Yes, keep waiting banksel SSPCON ; No, continue. DoI2CWrite bcf SSPCON,WCOL ; Clear the WCOL flag movwf SSPBUF ; Write the byte in WREG btfsc SSPCON,WCOL ; Was there a write collision? goto DoI2CWrite bsf SSPCON, CKP ; Release the clock. return ReadI2C banksel SSPBUF movf SSPBUF,W ; Get the byte and put in WREG return end ; End of file end If somebody can please point me in the right direction, it would be greatly appreciated. Thank you, ~Mikhail
  • ' ON 20080224@7:29:16 PM at page: http://www.piclist.com/microchip/index.htm#39501.620474537 James Newton[JMN-EFP-786] removed post 39501.620474537 |Delete 'main@yandex.com :
    National Transportation Safety Board recently divulged they had funded a project with the US auto makers for the past five years. The NTSB covertly funded a project whereby the auto makers were installing black boxes in four wheel drive pickup trucks in an effort to determine, in fatal accidents, the circumstances in the last 15 seconds before the crash.

    They were surprised to find in 49 of the 50 states the last words of drivers in 61.2% of fatal crashes were, "Oh, Shit!"

    Only the state of Texas was different, where 89.3% of the final words were, "Hey Y'all, hold my beer and watch this!"
    ' ON 20080227@8:17:24 PM at page: http://www.piclist.com/microchip/mplabbugs.htm#39504.9347337963 James Newton[JMN-EFP-786] published post 39504.9347337963 lachica@comcast.net
    I have a 16F690. The data sheet for this PIC says that the 16F690 program memory goes to 0FFFH. When I program the chip (with PicKit2) the code will not operate past 07FFH. I can "read" the code back and "verify" the code but it just does not execute - it stops working after this memory! PLEASE HELP!!
    |Delete 'P-' before: '' but after: '