Jump to content

toolrocket

EstablishedMember
  • Content Count

    26
  • Joined

  • Last visited

Community Reputation

0 Neutral

About toolrocket

  • Rank
    Regular

Profile Information

  • Gender
    Male
  • Location
    Ft Walton Bch, FL
  1. The .h files in the sourceboost\include directory have definitions of all the configuration bits. They did a really good job with that.
  2. In fact i'm sure it's not. I was hoping somebody had a work-around?
  3. Anybody have any words about changing configuration bits with the ezdownloader? The boostc manual makes it look pretty straightforward. Everything compiles ok, but crashes on download.
  4. I've tried using #pragma DATA to set various configuration bits, but it always ends up crashing ezdownloader.exe (brings up the "send error report window" ) Here's an example i just tried: #pragma DATA _CONFIG2H, _WDT_OFF_2H Trying to disable the WDT but failing...
  5. I guess i'm not certain whether it's sending a nullchar or not, but i dont know if it matters. There are 2 recieving devices on the PIC's Tx line, PC and Motor controller. The PC is just so i can see if Tx/Rx is happening, and the Motor Controller is expecting 0x00. The PC can't display the nullchar so it skips it. Sometimes when I putc() the whole alphabet and i replace the C with a 0x00 it will work 'correctly' and i'll get ABDEFG...Z. It just skips the 'C'. Other times, it skips 4 or 5 characters. The Motor Controller is expecting plenty of 0x00s. In fact, the second byte of it's message is always a 0x00. It's here if you care to look at it: http://www.pololu.com/catalog/product/376/resources I would think it's as simple as putc, putc, putc, putc but that doesnt seem to work. My thoughts are that when it gets to the 2nd byte of the message (the 0x00) it skips the remaining 2 bytes and no complete message is delivered. Also on that pololu website, there's an example program which says to make sure the PIC's WDT is OFF, does that make any kind of sense? EDIT: This probably has nothing to do with a PIC and doesn't belong in this forum. I'll figure it out eventually.
  6. I'm having trouble getting my PIC to put out a sequence fo 4 bytes. putc() doesnt seem to like 0x00. In a previous post, reynard said: "You cannot use puts(*mybuffer) to send your message as it contains a null (0x00) within it which will terminate the transmission early." Is there something similar with putc(0x00); ?? for example, i can successfully use the following to correctly display the entire alphabet... putc(0x61); //a putc(0x62); //b ... putc(0x7a); //z output: abcde...z HOWEVER, when i substitute putc(0x00); for say 'c' it will skip a bunch of the other letters and maybe start up again with 'j' or 'k' and the results are seemingly random. It looks like it gets to the putc(0x00); and just gives up. Is there some kind of special case for the 0x00? i also tried doing it in stragiht assembly by repeating this block 4 times in a row. It will put out 4 'a's no problem, but it doesnt like the 0x00 when i try that. asm //this is from memory, so there may be an error but it works just like putc() in my program, only longer and less efficient probably { updateMotor: btfss _pir1, TXIF goto updateMotor movlw 0x80 movwf _txreg nop } All i really need to do is send a sequence of 4 simple bytes to include at least one 0x00 (more probably 2 or 3).
  7. Ha, meant backslash-zero the whole time. and i even edited the post a few times from work. it looks like reyard's didnt work either... Also derkem, im certain i had orginially included the i++ bit (its on my notepad anyhow). I must have forgotten to type it into the post. Thanks for the heads up! Here's a test: "\" and in code tags "\" EDIT: This forum doesn't like the backslash-zero, regardless of what kind of tags it appears within.
  8. Pardon my lack of C experience: Is there a difference between the NULL ('\') and a '0x00' ? Reyard indicated that the NULL was 0x00, but other websites call it '\' -- heres to hoping it's . If so, I'm thinking something like this... char buffer[256]; void interrupt( void ) { clear_bit( intcon, T0IF ); //clear TMR0 overflow flag if( ( pir1&0x20 ) == 0x20 ) // If Rxflag = 1 then -----> { gets(buffer); int i = 0; while(buffer[i] != '\') { putc(buffer[i]); } } }
  9. Question 1: Could somebody please describe how and when to use the "gets" (as opposed to getc) function provided in rs232_driver.h? I'd like to send a string or phrase to my pic18f without having the overrun error trigger. I can send a string of 3 characters now, but any more than that and the OERR is thrown. Question 2: I need to send a 4-byte data packet (at a given baud) to a motor controller i have. I've tried: putc(0x80); Start putc(0x00); config putc(0x01); motor number putc(0x12); speed (1-127 dec.) but it doesnt seem to work quite right. Please advise.
  10. Moderator, please close and delete this thread. I had the UART on my USB/Serial thinger configured for 3V. there's 2 weeks of embarrassment and wasted time i wish i had back. thanks again, for all the help.
  11. I just want you to know how much i appreciate all of your help. Especially when this is probably something trivial and i'm so thoroughly blowing it. I was so good at this in college with a Motorolla HC11 - I guess it WAS so easy in a controlled setting with all those teaching assistants, equipment and tools available. It's curious how it only seems to work when the Tx block is configured inward (5V) and the Rx block outward (RS232). Works like a charm though (save the inversion), i'll just fiddle with it and do some bit shifting to get it turned around. I program using the bootloader, and leave the programming cable connected to the little db9 programming terminal all the time. Think that might dork it up?
  12. Thanks Dave and thanks Reynard- I cant seem to get my little Serial>USB module talking to the PIC module with the jumpers in any configuration other than TX2/3 and Rx5/6. i tired fooling with baudcon and changed bits 4 and 5 to invert the Tx and Rx, but that appears not to work in any combination. it seems like i've got to invert the Tx from my little usb/serial converter. Does that sound reasonable? it's got a setting i can change (if i can figure it out) but if i mess that up, could i use a hex inverter or something? thanks for all the input. I'll post a pic of my robot if i ever get it working... Edit: I've tried inverting tx and rx with the baudcon register, and no luck.
  13. allcon- I've got my UART working, it turns out i had to change a jumper on my PIC module. However, when i Tx a character down the line, the Uart replies with a different character. For example, i send a lower case 'a' and get back an upper case 'O'. The characters are the same every time, as per the table below, so at least it's something consistent. I mapped out the character codes for each tx/rx pair but can't find any recognizable pattern. Suggestions welcome. Tx Rx a O b ' c N d e M f & g L h " i K j % k J l m I n $ o H p q G r # s F t u E w D x y C z ! A _ B / C ^ D E ] F . G \ I [ J - K Z L M Y N , O X P Q W R + S V T U U V * W T Y S Z ) 1 g 2 3 3 f 4 5 e 6 2 7 d 8 9 c 0 - i = a ! o @ # n $ % m ^ ( & 6 * 5 ) k _ P + j ) k
  14. Another rookie question. I dont have the simulator icon (Fancy 'S') in my Sourceboost IDE toolbar. What licences do i need to buy to get that to appear and to get the plug-ins going?
×
×
  • Create New...