Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Louhimo

  • Rank
  1. Ok so i am capable to read Analog Input 0 from porta using the following code: int AdcSample(void) { short value; adcon1 = 0x00; ansel=0x7F; adcon0 = 0x81 | (0 << 3); delay_10us(10); adcon0 = adcon0 | 0x04; while(adcon0 & 0x04); ansel = 0x00; adcon0 = 0x80; value = (adresh << 2); value += (adresl >> 6); return (value); } And with a potentiometer, i can get values between 0 and 1024. But i'd like to know if there is a way to read exact value as millivolts, is this possible? I say when i put voltmeter between analog input 0 and ground and I read 0
  2. Ahh i found it out by myself already: interrupts. i had to add interrupt function into code, so now it works as it should. But i just wonder how the hell there were some random interrupts, or were those cause by the ADC funtions? No idea, works anyhow now!
  3. Okey i found out some weird things with my pic16f88: Sometimes it just resets and starts the whole program from start. I made LcdWriteValue function which is able to write any number to display from 0 to 999 and it works, but sometimes when this program counts, it just resets and starts all over. int counter = 0; while(1) { LcdClear(); LcdWriteValue(counter); counter++; delay_ms(200); } From programmer options: CP = OFF CCPMux: RB0 Debugger = OFF WRT = Writable CPD = OFF LVP = OFF BOREN = OFF MCLRE = MCLR PWRTE = Disabled WDTE = OFF OSC = HS IESO = OFF FCMEN = O
  4. Yeah thanks, found out how to turn off the comparators and now portb pins 0-5 are working fine. How about this: while(1) { porta = porta ^ 255; portb = portb ^ 255; delay_s(1); } Leds are blinking only at portb 0-5, whole porta is just 1, nothing blinks, but i guess that is cause i have not disabled ADC right? Trying to find that out now. But that portb pins 6 and 7 are only 1 and ain't blinking, that's strange, any advices ? //EDIT Yess found out that also portb had 2 analog input channels, and also i found out how to disable analog inputs, everything works, thanks both of
  5. First, a 16F84 has a different part number than 16F88. This makes me wonder why. Try reading the data sheet on PortB, there is more to I/O than tris. RB3 is not available for I/O Unless you ask for it first. keep smiling and keep reading. <{POST_SNAPBACK}> There are somekind of "comparator" modules O_o it seems i need to turn them off somehow, how do i do this with boostc Datasheets hardly tell me how to turn them off via boostc?
  6. Ok, i finally bought that PIC16F88, and i used following C code to program it: #include <system.h> //Target PIC16F84 configuration word #pragma DATA _CONFIG, _PWRTE_OFF & _WDT_OFF & _XT_OSC & _CP_OFF //Set clock frequency #pragma CLOCK_FREQ 4000000 void main( void ) { //Configure port A trisa = 0x00; porta = 0; //Configure port B trisb = 0x00; portb = 0; while(1) { porta = 255; portb = 255; } } And now i got a problem: everything else works, but Port B pin 3 gives nothing more but 0. Is that PIC broken, is my code wrong, i
  7. No no no and no Of course I do not wan't a ready code with correct timings etc. but what I want is the normal code which would explain a bit those functions i need to use etc. things? Yes i do find some tutorials using Pic Micro Assembly, but i guess they also integrated some functions to boostc so i could use C instead of assembly. And as i begged a code example, i just meant a code which could possible introduce those needed functions with correct parameters for me I don't want to be the one who copies everything from the internet. I am the one who wants to LEARN, as simple as that!
  8. Thank you all for responses, especially rfhaley for the code example, it seems logical But still i'd like to find a small tutorial with examples, because I might find it more useful than just copy/pasting from here Thanks in advance again...
  9. Yes i'd like onewire sensor, so i could connnect LCD display to same pic and then i could show the current temperature on the LCD But still the same question: i haven't found any tutorials how to use ADC functions etc code example would be nice, ty advance
  10. Hello again... Okey I am working with a small kind of weather project using PIC16F88, and i understood that whole PORTA is able to take analog input right? So, I am going to buy a temperature sensor and connect it to porta pin 0. But the problem is I don't find any tutorial / code examples how to read ADC values using boost C? Could anyone paste either links to tutorials, or pure code example how can i read adc value and save it to variable? Thanks in advance
  11. Wehee i got it working! Yes it was just like you said: it took TERRIBLE long to fire up first led (like whole minute or so) but now it works thanks Dave, i gotta play with it now, to find some good clockrate, thanks!
  12. What you mean "i can't use delay functions with such a low frequency"? You saying that i can't use any delay functions using this RC oscillator circuit, cause that would not be the best option Ofc i want some timing, tough it does not have to be accurate. But how the hell i am supposed to "blink" leds without any kind of timing O_o
  13. Umm i am such a newbie so far that i can't tell the frequency instantly But resistor is 330k and capacitor is 220pF, whole circuit has been connected like the example in http://home.planet.nl/~midde639/tutorial.pdf page 13, tough i put leds to every port output.
  14. Hmm yes it might have something to do with oscillator. On my test circuit, i only got simple RC oscillator cause it was easiest / cheapest to make. Any ideas how can i set my projects oscillator as RC oscillator, somehow using #pragma lines? Correct timing is not necessary, since atm i would just like to see leds blinking.
  15. On my test circuit, i use simple RC oscillator, so only resistor and capasitor. How can i set my projects oscillator to RC? Somehow using #pragma lines? Correct timing is not neccessary, since atm i would just like to see how it works.
  • Create New...