Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Daz

  1. Hi everyone, After a couple of years I am re-visiting my temperature conversion headache. The PIC is an 18F2525 @ 4MHz. dq is the I/O pin on RB0. The code below works to the point where the value displayed on the lcd is a large non sensical number that fluctuates. The problem I have is with the conversion formula (I have looked at and tried many versions found on the 'net'). It may be that I cannot use the 'float' command as my version of sourceboost ide doesn't support it (v6.40). Could one of you clever people take a look at my code and suggest a way around this problem. Many thanks in ad
  2. Thanks for your replies. A fundamental error on my part using rb1 as a switch input instead of rb0, the simulator now works. In the while loop this code amendment below works correctly. I hope these posts will serve to help others with similar problems. //Endless loop while( 1 ) { if(flag1) { led1 = !led1; //on/off flag1 = !flag1; //reset } }//while
  3. Hi, I've been away from the programming arena for some time now and I'm just on a personal re-fresher course. Please find below a program that uses 1 switch input to turn on an led. The program doesn't work when I run it in the sourceboost debugger. The breakpoint set in the ext int routine is never reached and therefore the led never lights, it may be obvious to you experienced guys out there any pointers would be apreciated. Thanks in advance. #include <system.h> //Target PIC16F877 configuration word #pragma DATA _CONFIG, _PWRTE_ON & _BODEN_OFF & _WDT_OFF & _L
  4. Hi IanM, At last someone who understands english. I will do as you've suggested, thankyou. Regards, Daz.
  5. The A2D has been performed and I want to display the result.
  6. Hi, Probably a simple answer to this. I have comms using an rs232 line driver to the pc (sourceboost terminal) displaying letters numbers and strings, so far so good. I want to display the results of an a2d conversion, any clues please. Regards, Daz.
  7. Still cannot get it working. Does anybody have a working version of code for a2d conv. on a 12f675 that I can compare to?
  8. Thanks for replying so promptly, it really helps to have another pair of eyes look at a problem. I will change the code as you've suggested and hopefully get some good results. p.s. Dave, Pavel will the IDE simulator have the facility to simulate 12f*** pics' soon?
  9. Lets try it this way. #include <system.h> //Target PIC12F675 configuration word #pragma DATA _CONFIG, _PWRTE_ON & _BODEN_OFF & _WDT_OFF & _CPD_OFF & _INTRC_OSC_NOCLKOUT & _CP_OFF //Set clock frequency #pragma CLOCK_FREQ 4000000 //Outputs volatile bit gp0@GPIO.0;//analog i/p volatile bit gp1@GPIO.1;//analog i/p volatile bit gp2@GPIO.2;//motor drive volatile bit gp4@GPIO.4;//enable volatile bit gp5@GPIO.5;//motor drive #define motor_clockwise gp2 //pointer travels up #define motor_anticlockwise gp5 //pointer travels down
  10. Hi, I am trying to get the a2d to work with a 12f675. Has anyone any experience with this pic? I have simulated the a2d using a 16f877 with sourceboost IDE, but unfortunately cannot simulate with the 12f675. Can anyone see where I'm going wrong. CODE #include <system.h> //Target PIC12F675 configuration word #pragma DATA _CONFIG, _PWRTE_ON & _BODEN_OFF & _WDT_OFF & _CPD_OFF & _INTRC_OSC_NOCLKOUT & _CP_OFF //Set clock frequency #pragma CLOCK_FREQ 4000000 //Outputs volatile bit gp0@GPIO.0;//analog i/p volatile bit gp1@GPIO.1;//analog i/p
  11. Ok, thanks. Will they be supported as I'm sure I will not be the only one with this headache? Over to you guys, Dave and Pavel! Regards, Daz.
  12. Hi all, I am trying to print letters sourced from an array onto a lcd. char array[2] = {'a','b'}; unsigned int i; for(i=0; i<2; i++) { lprintf("%C",array[i]); } Using "%C" or "%S" does not work. Regards, Daz.
  13. Hi all, I'm using the SPI feature on a 16f877. Does anyone know how I would go about accessing memory location 0x80 of a slave device and writing or reading the contents of sspbuf to or from it? I can read and write to the slave at the moment, but I need to read / write to specific memory locations. Regards, Daz.
  14. Thanks emte, At last it makes more sense, I will now re-evaluate and hopefully get the desired result. Regards, Daz.
  15. Obviously the 'oo' function code doesn't work as expected (proved by the lack of replies).
  16. Hi, I need a definitive answer to my one wire problem please. Regarding my previous posts on the subject, I'm still having no luck after using various methods. Will someone please tell me in what format the 'data' is returned after a temp. conversion. i.e. 9 bytes, bytes 0 & 1? etc.... The sensor is working regarding the s/ware and h/ware sides of it, but, I cannot work out how to use the data, (which returns as -1 and doesn't vary at all with temperature). With the lcd header file it can be opened and you can work out what is happening not so with the one wire header. Does it actu
  17. Hi, Sorry to keep on, but, whilst I am using the sourceboost library files ( as seen in my previous post ) it seems that 'data' is returned in 9 bit format. Regardless of the format returned should I be able to see a change in the displayed reading with regard to the hardware that I am using with the sensor / software? i.e. a change in value even if it makes no numerical sense? Regards, Daz.
  18. Hi all, After weeks of on and off perserverence, different code methods and pulling out lots of hair, I need a third party's veiw on things. Here is my code, On the lcd I read 111111111b, and -1 in decimal. How do I convert this data into a meaningful temperature value? #include <system.h> #include <oo.h> #define LCD_ARGS 2, /* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \ 0, /* Use busy signal: 1 = use busy, 0 = use time delays */ \ PORTD, TRISD, /* Data port and data port tris registe
  19. Thanks for everyones help. Regards, Daz.
  20. Hi Dave, I added a 1 second delay after the print command and I get a value of '-1', regardless of the state of the sensor. Does this seem correct, I thought the value would vary even if the value didn't make sense? Regards, Daz.
  21. Hi all, This is getting extremely stressful now. I don't understand what the functions in the 1 wire routine are doing. I presumed (wrongly it seems) that if I put them into my project, then printed the 'data' from the 'short data = oo_get_data();' function then I would get some sort of value. Is this right or wrong? very confused, Daz.
  22. Hi, For future reference, this compiles. #define oo_port portb #define oo_tris trisb #define oo_pin 6 volatile bit oo_bus @PORTB.6; volatile bit oo_bus_tris @TRISB.6; Regards, Daz.
  23. Hi, I've still got a problem when compiling. volatile bit oo_bus @ OO_PORT . OO_PIN; The error states "miising fixed address". I'm using Sourceboost v6.40 and PIC16f876 if that helps. Anyone got any ideas? Regards, Daz.
  • Create New...