Jump to content

Reynard

EstablishedMember
  • Content Count

    688
  • Joined

  • Last visited

Everything posted by Reynard

  1. Neil, This has been asked before. http://forum.sourceboost.com/index.php?showtopic=3693&hl You can use #pragma DATA blockaddr,1,2,3,4,5,6 where blockaddr is the rom address for you data such as 0x1000. Just be sure the address is well away from your code such as top of rom. You will probably need to resort to assembler to get access to it, or use flash read/write features of your pic to load chunks into ram etc. Cheers Reynard
  2. A "Break" to me is just a long "Start" bit that extends beyond the "Stop" bit. I don't think the exact time is important so long as it is greater than one character period. A "Start" bit, like a "Break" is a logic 0 coming out of the PIC Tx pin. If the receiver wants a "Break" of a certain length, then it should be in the receiver spec. I have used Philips UARTS and they only require a one character wide break for it to record it and put all zeroes into the receive register. Cheers Reynard
  3. I am not sure if this will work but give it a try. During usart initialise set portb.2 = 0 (I am assuming trisb.2 is = 0). When you need to send a break disable the usart rcsta.SPEN = 0 which will put the port latch value (0) onto the pin. Wait the desired break time then re-enable the usart again and the pin should return to its idle condition of 1. Cheers Reynard
  4. I think you may be pushing BoostC beyond its limit with this one Jos. Replacing rom with const in MikroC does exactly what you want to do. I shouldn't say that though. Cheers Reynard
  5. The multiplication function is in one of the BoostC libraries. You will have to tell the linker which and where to find the library to add in with the object files. Something like this but with your file paths. "C:\Program Files\SourceBoost\boostlink.pic.exe" /ld "C:\Program Files\SourceBoost\lib" libc.pic16.lib MYOBJECTFILE.obj libc.pic.16.lib are for PIC16 devices. Cheers Reynard ps. The *4 only requires a bit shift hence no multiplication function required.
  6. Not so fast Carnage ! This: #pragma DATA 0x000008, 0xEF04, 0xF008 #pragma DATA 0x000018, 0xEF0C, 0xF008 produces this: 0008 EF04 DW 0xEF04 0009 F008 DW 0xF008 0018 EF0C DW 0xEF0C 0019 F008 DW 0xF008 so 16 bits are allowed in a #pragma DATA directive. The config word on a PIC16 is 14 bits or there abouts and that works. Cheers Reynard
  7. Page 43 of the manual should explain BoostC limitations on ROM data. You have to access ROM data through an array [] operator and not a pointer. I hope there will be a solution in the future for this. So you have to do you output loop a different way. unsigned char x = 0; rs485put( romDataToSend[x++] ); Cheers Reynard
  8. Your program actually starts at address 0x0000, the reset vector, with a jump (goto) to startup. I don't know why you think your code should start at address 0x0004. The question that I would be asking is why are addresses 0x0001 and 0x0002 no used (spooky!). Cheers Reynard ps. Add this function to your code and see what happens: void interrupt(void) { }
  9. The header "strstrea.h" you can just comment out and it will still compile. You don't need MFC to write a dll that creates a window. You can do it all with API calls but it is much more work. MFC is just a very thick skin around API calls. Cheers Reynard
  10. I certainly have the <strstrea.h> in my VC98\include directory. Cheers Reynard
  11. VS 6.0 loads the project OK. Are you trying to use C++ .NET ? Cheers Reynard
  12. I have used a 16F873A as a master talking to 3 non-pic slave devices without problems. I wrote my code to be all interrupt driven with a simple state machine. Something that you want to look out for is that your slaves can respond fast enough when addressed. Usually the slaves will hold the clock line until they have fetched the data to write or a pointer to a buffer has been set up to read data. Only then will you release the clock line to inform the master you are ready to rock-n-roll. If you let the clock line go after receiving the address, the master will think you are (slave) ready to read or write and start clocking you before you are ready and data may be lost. I too have not use the code you have used or BoostC I2C libraries, so cannot comment on their operation. Cheers Reynard
  13. The boostC manual page 38 shows how it is done for the 16 and 18 series of devices. Which bits are to be set or cleared will of course depend on your application. How do you want to program the device, what is your oscillator source, what features do you want to use etc. Only you can answer these questions. BoostC will set bits to all 1's for the config byte/word that you define a bit for until you set it to 0. Note that the erased config byte/word can default to 0 bits which can catch you out. Extended instruction mode for example. Cheers Reynard
  14. Try using the PIC16F630 to develope your code. It is very similar and you could probably plug it into the same 8 pin socket with a few legs hanging over the edge (port C, lower 6 pins). OR, even the PIC16F676 for the adc version. Add this to the top of your file and you are off and running. #define gpio porta #define trisio trisa Cheers Reynard
  15. Header files (.h) are not generated automatically. You have to build them yourself. Open a blank page. Insert you function prototypes as trossin says (char ScanKeyMatrix(void). Save the file as test.h You now have your .h file to match your .lib file. Cheers Reynard Remember: If you use #include <test.h> , the compiler expects the .h file to be in the ...\SourceBoost\include directory. Use #include "test.h" if the header is in your local project directory. Or just use the full path name.
  16. To build (compile) a library, goto "Settings -> Options...", select Output Type: Library radio button. To add a library to your project, goto the Workspace (project) window (left of screen usually), right click and add the .lib file you want to include. Cheers Reynard
  17. Hardware ports can look like an 8 bit byte in memory if all pins are configured as outputs. ADDRESS++ or portb++ will increment the least significant bit (bit 0) and ripple the carry through to the rest of the bits. You cannot directly increment starting at bit 3 for only 3 bits. It can be done in software by reading the port, ANDing out bits 3,4,5, incrementing your counter variable by 0x08, and int by 0x38, then ORing that back into the port value and writing it back to the port. If you ONLY have bits 3,4,5 set as outputs (the rest inputs) then you can increment your own counter variable and write it to the port. myCounter = (myCounter + 0x08) & 0x38; portb = myCounter; Cheers Reynard ps. You could also say portb += 0x08; for the above code example.
  18. Nothing here really that BoostC can't do. In the chip header file you will see all the register definitions volatile char porta @PORTA; volatile char portb @PORTB; volatile char portc @PORTC; volatile char portd @PORTD; /* PORTB */ // High byte of PORTB contains CHARGE in lower 5 bits (amount to charge to credit card) #define CHARGE (~PORTBH & 0x1F) this becomes #define CHARGE (~portb & 0x1F) unsigned char myCharge; myCharge = CHARGE; // get least 5 bits of port B inverted. a #define is just a text substitution macro. Cheers Reynard
  19. There is no new bit variable created called pinB1. pinB1 is just another way of saying portb.1 As you may have already found out; bit arrays and structures are not supported by BoostC. I guess you will have to create a byte variable and rename the individual bits. Cheers Reynard
  20. If you have the watchdog timer enabled in the config, let it take you back to the reset state. It is very similar to MCLR. Cheers Reynard
  21. You will have to construct your own sprintf to do floats using the float math library and the sprintf32 function. Get the int32 value for the integer part of the float. sprintf32(the integer part) add a decimal point to the buffer. Subtract the int32 value from the float to leave the fractional part. Multiply the fractional part by the number od decimal places (3 places multiply by 1000). Get the int32 value of the float (now fractional part). sprintf32(the fractional part). There may be other solutions. Cheers Reynard
  22. I see what you mean about do not compile. It seems that the file "boostbasicpic16.bas" is missing a few chips. (Dave and Pavel take note!) You can try editing the file to include the missing chips. #ifdef _PIC16F887 #include <basic\PIC16F887.bas> #endif Rem _PIC16F887 Cheers Reynard
  23. Hi Danny, Reading the spec sheet; this chip requires a 1Tcy between the port read and interrupt clear. Try an nop(); in there. As the key is human operated you could try polling every couple of ms. Cheers Reynard
  24. Are you really sure that you are getting a clean release from your key ? Have you tried a couple of hundred pF to ground on this line. Try not reading portb so often. Every time you read or write portb you update the change register. if (intcon.RBIF) { B_Current = portb; intcon.RBIF = 0; if(((B_Status ^ B_Current) & 0x10) == 0x10) ... B_Status = B_Current; } The 'return;' is not necessary at the end of the interrupt routine. Cheers Reynard
×
×
  • Create New...