Jump to content

MotoDog

EstablishedMember
  • Content Count

    31
  • Joined

  • Last visited

Community Reputation

0 Neutral

About MotoDog

  • Rank
    Regular
  1. Stupid Me! The 883 does not have PORTD, I should have picked the 887! I finally printed the Header Files and am going to put them in a binder! I helps to know what is defined! Gonna be OK soon! Thanks Mike
  2. I have a program I did in BoostC with an 877 that compiles and runs in hardware. It moves a model servo and takes A/D data. Worked fine for over a year. I got back to it and some newer Pics and started getting PWM going, but found out I could not go slow enough with the pre-scaler in the 883? A full 16 PMW would be nice, rather than 10. I want 20mS period, seems there is a max of 16 pre-scale in this part. At 8 to 20 MHz clock, you can't get lower frequencies. So, I decided to go back to my old method using a lot more code. I switched the target Pic to 16F883. There wa
  3. I got LCD routine in "Samples" working on 16F877 with my port assignments. All I have is ONE LINE LCD 16 Char LCD displays. The one liner's stop at 8 characters, the 9th starts like line 2 of a TWO LINE LCD. Has anyone added a modification for ONE LINE LCD'S to the Sample LCD Code? A parameter I can add to change the addressing? Thanks! Mike
  4. Oh my. I looked at that many times, and thought it was for "interrupt on Port Changes"? I did not over look it, just thought it was for ports? Thanks! Now I get to continue! I am going to make a variable width pulse every 20mS for a model servo! Fun! Mike
  5. Dave, I moved over to running under MPLAB. I copied the whole sub directory from SourceBoost to MPLAB and built a new project including SourceBoost tools. It is interesting that the Sim does not show the Pointer to the start of main() after a reset. If I "step into" 4 times, the Green Arrow finally shows up at main()? I think it is starting at the interrupt when reset? Although the Location Arrow is missing until 4X step into? Your manual says every program has to have an interrupt function and a main. I used the project wizard from another part to start this example?
  6. Dave, Here is the code for a 20 mS interrupt by Timer1. I took some stuff out to shorten it. I hope I did not screw it up. Thanks for looking at it! Mike //////////////////////////////////////////////////////////////////////////// #include <system.h> // #include <icd2.h> // needed only if icd2 used for debugging #include <PIC16F88.h> #pragma DATA _CONFIG1, _PWRTE_ON & _WDT_OFF & _HS_OSC & _CP_OFF & _LVP_OFF // #pragma OPTIMIZE "0" //Set clock frequency #pragma CLOCK_FREQ 8000000 //*************************
  7. Well I am in MPLAB simulator running boostC. I see my Timer1 count go up and roll over and set the Interrupt Flag (TMR1IF) go high. Same result as in BoostC IDE running simulator, no interrupt? Instructions in Sim says it does interrupts for this part (16F88) and using Timer1. No Interrupt? PIE1, TMR1IE is high as well as TICON,TMR1ON. INTCON GIE is set too? Is there some switch to turn on Interrupts in MPLAM Sim? Also using Boost C under MPLAB, the cursor doesn't to to start of code in the simulator on reset? I can set a break point and run. Then I see were the code has
  8. Are there any help files on the simulator? Simulating inputs? Does it do Interrupts? I can't get it to break at an interrupt set up on Timer1 (I hope!) on 16F88? I see the Hi and Lo bytes of the counter changing in the register window as I single step, but it never stops in the interrupt? Thanks, the learning curve continues! Mike
  9. I have the converter set for 16Tosc per section 12.2 of the data sheet for 8MHz. I can't find how long the A/D takes to get ready when it is turned ON. I did find a warning in Sec. 12.5, not to turn it on and start an A/D in one instruction. From that, I guess it is ready in F/4? I could not find this in the hardware section of the spec? For now, since I saw a problem with the first reading being different with successive readings, I added a delay? Thanks Mike Also called Data Acquisition time. Regards Raghunathan
  10. while (adcon0.NOT_DONE) while (adcon0.GO) Works fine now! Both GO and NOT_DONE are defined the same. Turning On and Off the A/D to save power caused some difference in readings? I added a 1mS delay after powering on the A/D before starting a conversion. I need to find the spec? I did read NOT to set it in the same command with the Start. So the problem was the COMMA instead of a PERIOD!! Which is what you questioned! Thanks, Whoopie! Mike
  11. // volatile bit Adc_go@ADCON0.GO; This may work, making a Bit Variable? This more direct method works. while (adcon0.GO) GO is defined in h file as bit1 of adcon0 It now works! Thanks!!! Mike
  12. Good point! I am not much of a C programmer, so it may not be legal? I was thinking it would equal 1 while converting, so it would be while(1)? Thanks, that is exactly where the problem is, everything works up to there? It got through the compile and build? I will try it differently! Mike
  13. Seems the registers for the A/D in the 16F88 are not the same as the examples provided in ADC.c and ADC.h They were written for older parts? Also, there was NOT a 16F88 in the Project Wizzard? I have tried doing it in the following, I hooked up an F88 on a PicDem1 board with the LEDs on Port B and try reading Port A.0 Analog input. I used an 8MHz crystal. I think the converter GO/Done bit is never going LOW? So I am hung up. Hardware gets through some Led blinking for debug and seems to stop at the conversion? Anyone see what I left out or did incorrectly? Thanks, Mike
  14. I am trying to get a 16F877 serial port working with the rs232_driver in the Sourceboost library. I finally went back and made the program below using the 877 template and added the variables from the rs232 driver header. It is just to figure out how to use this library and driver. I am not sure about what the "emulation" is all about. Is it for debug without the hardware? I think I just need the Hardware definitions? Can I eliminate all emulation references? It errors loading the arguments in the header when I try to build. I know I am missing something here. There i
  15. This works on the PicDem 2+ Proto board ??? I looked at one pin with a 10K pullup with a DVM You must have a cockpit error somewhere? // portdtest.c #include <system.h> //Target PIC16F877 configuration word #pragma DATA _CONFIG, _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_OFF & _CPD_OFF & _DEBUG_OFF & _HS_OSC & _CP_OFF //Set clock frequency #pragma CLOCK_FREQ 4000000 void main( void ) { trisd = 00000000b; while(1) { portd = 0; delay_s(1); portd = 255; delay_s(1); } }
×
×
  • Create New...