martintorres
- 21st September 2012, 05:52
Hello friends, I am tortured with a PIC16F877 and Proteus EEPROM memory (for now I simulate it and then see if we practice on a protoboard) ...
I stuck to the following issue: how I can save a 10bits variable in eeprom?
For example, today I read the sign and put it in a format of 10bits:
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
Adc VAR WORD
D0 VAR Adc.0
D1 VAR Adc.1
D2 VAR Adc.2
D3 VAR Adc.3
D4 VAR Adc.4
D5 VAR Adc.5
D6 VAR Adc.6
D7 VAR Adc.7
D8 VAR Adc.8
D9 VAR Adc.9
I currently play for the variable in a 10-bit DAC I do is this:
TRISA = %11111111
TRISB = %00000000
TRISD = %00000000
ADCON1.7 = 1
Inicio:
ADCIN 0,Adc
PORTD.0 = D0
PORTD.1 = D1
PORTD.2 = D2
PORTD.3 = D3
PORTD.4 = D4
PORTD.5 = D5
PORTD.6 = D6
PORTD.7 = D7
PORTB.0 = D8
PORTB.1 = D9
GoTo Inicio
What I like to do now is see how these bits can be saved in an EEPROM, then call them and load them into the various bits of the DAC port to play ...
Basically, what I'm trying to do is a kind of mini chipcorder, as well as this program, you can add sound, and play it in real time by the DAC (well, not very accurate, but this would be the beginning)
Regards
Martin Patagonia Argentina
I stuck to the following issue: how I can save a 10bits variable in eeprom?
For example, today I read the sign and put it in a format of 10bits:
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50
Adc VAR WORD
D0 VAR Adc.0
D1 VAR Adc.1
D2 VAR Adc.2
D3 VAR Adc.3
D4 VAR Adc.4
D5 VAR Adc.5
D6 VAR Adc.6
D7 VAR Adc.7
D8 VAR Adc.8
D9 VAR Adc.9
I currently play for the variable in a 10-bit DAC I do is this:
TRISA = %11111111
TRISB = %00000000
TRISD = %00000000
ADCON1.7 = 1
Inicio:
ADCIN 0,Adc
PORTD.0 = D0
PORTD.1 = D1
PORTD.2 = D2
PORTD.3 = D3
PORTD.4 = D4
PORTD.5 = D5
PORTD.6 = D6
PORTD.7 = D7
PORTB.0 = D8
PORTB.1 = D9
GoTo Inicio
What I like to do now is see how these bits can be saved in an EEPROM, then call them and load them into the various bits of the DAC port to play ...
Basically, what I'm trying to do is a kind of mini chipcorder, as well as this program, you can add sound, and play it in real time by the DAC (well, not very accurate, but this would be the beginning)
Regards
Martin Patagonia Argentina