Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Picxie

  1. The PIC16F648 has a built in UART IE hardware that does rs232 for you. The example provided with sourceboost uses a processor intensive process known as bit bashing. It is provided for PICs that do not have a UART You would be far better learning to use the built in hardware following the guide lines supplied by c58_4311 and referring to the PIC data sheet. After all you have paid for it! the data sheet is available at http://ww1.microchip.com/downloads/en/devicedoc/40044d.pdf
  2. Looks like you will have to use the inline assembler to issue a tris instruction.
  3. How about create a new c and h file pair and add to project also automatically add (user supplied)boiler plate comment to top of file.
  4. Maybe my code is so good that it defies optimization! Did a bit more tinkering about adding this pragma to various points and got some reduction in code space. Does the pragma only work on the function following? How can I get global optimization? What about the linker optimization options, how do I get them? I tried modifying the make file but it got overwritten when I did a build.
  5. Hi I've tried using the optimisation pragma eg #pragma OPTIMIZE "0" I have included the pragma in a header seen by all the .c files. I have tried all options 0,1,a and even p but in each case the outcome is the same code length. BoostC18 6.31
  6. Hi there C58_4311, Well, I should admit that I am a beginner in using PICs. I´ll be happy if you could give me a hand. Regards, BUDDY <{POST_SNAPBACK}> So, I'll ask again, what have you done so far towards this? You cant be helped if no one knows what you have done so far!!
  7. Had a look in the standard It seems this is what happens with unary operators quoting from ISO/IEC 9899 Unary arithmetic operators 4 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is, each bit in the result is set if and only if the corresponding bit in the converted operand is not set). The integer promotions are performed on the operand, and the result has the promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent to the maximum value representable in that type minus E.
  8. Sorry for quoting the bit about garbage, it was unintentional, I guess my cut and paste scissors need sharpening. I've just looked through some code, it seems strange that other bitwise operations dont promote. Would it be possible to have some pragma to turn this off?
  9. The result of ~i gets promoted to 16 bits <{POST_SNAPBACK}> Why is this done? both arguments are unsigned char. I would expect like for like comparison. Would this be done if the ~ operator was not used?
  10. Hi How about if the ide could open a window direct to the forum so I dont have keep opening an IE window.
  11. That is C, an inline c function, every time you call function flipBout() the compiler inserts comf trisb,f into code rather thana call to a function. Not as elegant as trisb = ~trisb; and in the light of the other de efficiencies you have found probably not much help, but then again I've never used 16bit or 32 bit data types on PICs... yet. BTW when you get to 10 posts they no longer revue your posts before putting them on, so you wont get that lag of several hours. much more convenient for discussing things.
  12. The .pat script files in C2C where good for mopping up some of these sort of cases. Does BoostC use the script files?
  13. Hi you could use an inline for now.EG inline void flipBout() { asm comf _trisb,F }
  14. Close. It means every 8 instruction cycles. One PIC16 and 18F families 1 instruction cycle = 4 crystal cycles. This is why a PIC18F processor running at 40MHz is rated at 10MIPS. So in your example, a prescalar of 8 will give one timer increment for every 32 crystal oscillator ticks. <{POST_SNAPBACK}> For additional info Timer 2 has a POST scaler as well as a PRE scaler. The post scaler counts the number of time the timer times out before triggering the ISR. Note timer2 has a reload register so requires no intervention to reload when timed out. Timer 2 can be used as the
  15. There are two groups of interrupts on a PIC 16. First are the interrupts common across the family, second are interrupts specific to the hardware available on a particular device EG ADC. Each interrupt is enabled by setting its enable flag ie xxxIE When an interrupt is triggered its flag bit is set ie xxxIF. There is only one interrupt vector on a PIC 16 and therefore only one interrupt routine In the interrupt routine you will have to examine the flag bits one at a time for all the interrupts you have enabled and do your service, remember to clear the flag bit or when you exit the
  16. No misleading information has been supplied, Andrew's code was provided with no knowledge of the PIC family involved so he assumed PIC18 and provided a solution which would work on that family, I have indicated where the differences can be found by a little research. Refer to the data sheet for the target device Refer to the compiler help files Dont ask general vague questions, ask on specific areas that you are having a problem with.
  17. But a nudge in the right direction helps. Buddy, the PIC16 has only the one config register so all those #pragma lines at the beginning do not apply in your case. Get the 16F87x data sheet from www.microchip.com (if you dont already have it) The config register is outlined in the chapter "special features...". Also have a look at "read modify write", search the spec sheet for details. This explains why writing to PIC16's primitive ports may not give intended results.(And if you have a look at a PIC18 spec sheet you can see how the lat registers work ) Andrew's code is a good s
  18. Latch register for portb on a PIC18, Microchips 'cure' for the read modify write problem with ports on PIC16. <{POST_SNAPBACK}> Or to put it another way, Andrew's code is not going to work on Buddy's PIC16F877 without some adaption.
  19. Latch register for portb on a PIC18, Microchips 'cure' for the read modify write problem with ports on PIC16.
  20. Sorry - I was bored :-) <{POST_SNAPBACK}> If you give a man a fish you feed him for a day, If you give a fish a... oh wait thats not right
  21. //////////////////////////////////////////////////////////////////////////// // LEDs Test Program //////////////////////////////////////////////////////////////////////////// // Author: Andrew Smallridge .... } } } <{POST_SNAPBACK}> Very nice! but I was trying to encourage the OP to think more of the problem so that he would learn something.
  22. I just tried this with the BoostC compiler Foo( 2 ); Boostc gives as an error "arguments of function dont match parameters of call" Foo( 8 ); Boostc gives the same error
  23. Really your best option is to rejig the hardware to make RB3 available for the CAPCOM, it makes writing out to the LEDs a pain but you have a C compiler so just write a function write8segLEDbits(char bits); However if you must leave the hardware as is, then set a timer free running, monitor RA4 and read the timer each time RA4 changes state. You should generate an interrupt when the timer overflows and count this. Use the timer interrupt to output a column of your LED multiplex.
  24. What thoughts have you had on how to implement this so far? What processor are you planning to use?
  • Create New...