Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About McNerdius

  • Rank
  • Birthday 08/25/1984

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Gender
  • Location
    Perry, Iowa
  1. I'd been having problems with an 18F based project - till i realized it worked via pickit 2 ICD. So i started reading around - and found out that my problem is almost certainly that the debug bit is 0 in CONFIG1L. I can't get this to set via pickit - i've tried various methods. Its probably got to do with the fact that the config's are loaded differently on these parts than some others. Anyhoo, the questions are - 1) I see a drop-down menu with one option in it: "DEBUG" I can only assume this is a build-option... Clearly i am trying to do a Release build, not a debug... yet i can't find any mention of this dropdown in the manuals, and after 45+ minutes of googling and searching the forums, i can't figure out any way of changing from debug to release... 2) (Some lines trimmed): Building... "C:\Program Files\SourceBoost\boostc_pic18.exe" app.c -t PIC18F26J11 -idx 1 -obj Debug -d _DEBUG BoostC Optimizing C Compiler Version 7.03 (for PIC18 architecture) Single user Lite License (Unregistered) for 0 node(s) app.c success "C:\Program Files\SourceBoost\boostlink_pic.exe" -idx 1 /ld "C:\Program Files\SourceBoost\lib" libc.pic18.lib Debug\app.obj /t PIC18F26J11 /d "Debug" /p app BoostLink Optimizing Linker Version 7.03 Building CASM file Memory Usage Report =================== RAM available:3776 bytes, used:2 bytes (0.1%), free:3774 bytes (99.9%), Heap size:510 bytes, Heap max single alloc:127 bytes ROM available:65528 bytes, used:76 bytes (0.2%), free:65452 bytes (99.8%) success Done OK so there are several "debug" command-line options in there. The question is - how did they get there ? I can't find any way of changing from debug to release or what have you, i don't have any "extra" compiler or linker options defined - nor can i find any information regarding this topic after quite a while of googling, menu-searching, or manual-reading. Lastly - is this quest for a "Release" option going to do me any good ? After all, i'm only looking to set my debug bit in CONFIG1L - which i can do right now by tweaking my TDF file. But if there is a "proper" intended way of doing this, i'd like to think i'm just missing it...
  2. Yep. Good news too... well, news anyway. It works via debug mode. I'd personally never used debug on anything, so it took a bit of fiddling to figure it out this evening, but sure enough - things run nicely via debug. As i'm not familiar with In-Circuit-Debugging, i can only make guesses as to what this means about my project. The one and only thing that comes to mind is clocking. My configuration bits and osccon are correct, therefore i assume my problem is the aluminum electrolytic capacitor i am using for vddcore. Then again... That's just an uneducated guess.
  3. Pics of hardware attached. I had been assembling it on a SBB, then said screw it and put it on a perfboard. I'm hoping at this point all that i need to do is use a higher-quality capacitor. It's always something stupid.
  4. void main() { osccon = 0b01101100; ancon0 = 255; ancon1 = 0b00011111; //disable analog crapola trisa = 0; porta = 0; trisb = 0; portb = 0; latc = 0; trisc = 0; portc = 0; while (true) { portc=255;//latc=255; delay_ms(1); portc=0;//latc=0; delay_ms(1); } } It's all there in my post man. you'll note that i set bit six of adcon1 as 0, just as page 353 of the manual instructs. I've read the manual, and as a side note - the topic of my post is "Newbie to 18F failing to flash Led." I know it's common for newbies to post expecting a solution without having googled, read the manual, or experimented. That's not the case here. If the code i posted in my original post looks flawed, let me know.
  5. Will do on the XINST (when i get home). I meant for that to be a delay_s(1) ... odd... my fingers are betraying me. However, i've recently changed the loop to: while (true) { latc = 255; } still no luck.
  6. OK OK i feel like an idiot. I'm putting this here because it's so incredibly common when learning the ins and outs of a new product family to COMPLETELY AND TOTALLY miss something. I've googled to no avail in regards to some bits of code out there... I'm new to this family and have done very little with 18Fs in general. All i'm doing at this point is trying to flash an LED on portc - just to get my feet wet. Here is what i have (sorry it's so darn long... i'm including it ALL) #include <system.h> ////////////////////////////////////////////////////////////////// // Watchdog Timer: #pragma config WDTEN = OFF // Disabled - Controlled by SWDTEN bit ////////////////////////////////////////////////////////////////// // Stack Overflow/Underflow Reset : #pragma config STVREN = ON // Enabled ////////////////////////////////////////////////////////////////// // Extended Instruction Set: #pragma config XINST = ON // Enabled ////////////////////////////////////////////////////////////////// // Code Protect: #pragma config CP0 = OFF // Program memory is not code-protected ////////////////////////////////////////////////////////////////// // Oscillator: #pragma config OSC = INTOSC // INTOSC ////////////////////////////////////////////////////////////////// // T1OSCEN Enforcement: #pragma config T1DIG = ON // Secondary Oscillator clock source may be selected ////////////////////////////////////////////////////////////////// // Low-Power Timer1 Oscillator: #pragma config LPT1OSC = ON // Low-power operation ////////////////////////////////////////////////////////////////// // Fail-Safe Clock Monitor: #pragma config FCMEN = ON // Enabled ////////////////////////////////////////////////////////////////// // Internal External Oscillator Switch Over Mode: #pragma config IESO = OFF // Disabled ////////////////////////////////////////////////////////////////// // Watchdog Postscaler: #pragma config WDTPS = 1 // 1:1 ////////////////////////////////////////////////////////////////// // DSWDT Clock Select: #pragma config DSWDTOSC = INTOSCREF // DSWDT uses INTRC ////////////////////////////////////////////////////////////////// // RTCC Clock Select : #pragma config RTCOSC = INTOSCREF // RTCC uses INTRC ////////////////////////////////////////////////////////////////// // Deep Sleep BOR : #pragma config DSBOREN = OFF // Disabled ////////////////////////////////////////////////////////////////// // Deep Sleep Watchdog Timer: #pragma config DSWDTEN = OFF // Disabled ////////////////////////////////////////////////////////////////// // Deep Sleep Watchdog Postscaler: #pragma config DSWDTPS = 2 // 1:2 (2.1 ms) ////////////////////////////////////////////////////////////////// // IOLOCK One-Way Set Enable bit: #pragma config IOL1WAY = OFF // The IOLOCK bit (PPSCON<0>) can be set and cleared as needed ////////////////////////////////////////////////////////////////// // MSSP address masking: #pragma config MSSP7B_EN = MSK7 // 7 Bit address masking mode ////////////////////////////////////////////////////////////////// // Write/Erase Protect Page Start/End Location: #pragma config WPFP = PAGE_63 // Write Protect Program Flash Page 63 ////////////////////////////////////////////////////////////////// // Write/Erase Protect Region Select bit (valid when WPDIS = 0): #pragma config WPEND = PAGE_0 // Page 0 to WPFP<5:0> erase/write-protected ////////////////////////////////////////////////////////////////// // Write/Erase Protect Configuration Region : #pragma config WPCFG = OFF // Configuration Words page not erase/write-protected ////////////////////////////////////////////////////////////////// // Write Protect Disable bit: #pragma config WPDIS = OFF // WPFP[5:0], WPEND, and WPCFG bits ignored void main() { osccon = 0b01101100; ancon0 = 255; ancon1 = 0b00011111; //disable analog crapola trisa = 0; porta = 0; trisb = 0; portb = 0; latc = 0; trisc = 0; portc = 0; while (true) { portc=255;//latc=255; delay_ms(1); portc=0;//latc=0; delay_ms(1); } } as you can see, i've set my tris values, my oscillator setup should be ok, i've disabled analog, disabled WDT, and everything else i've ever needed to do and everything i need to do as i understand it. NO WORKY. If anyone can be so kind as to give it a quick look-see and maybe even tell me what this LATC/LATB/etc stuff is (i mean, in practical language, not manual-speak) i would much appreciate it ! Thanks.
  7. YAY IM AN IDIOT #pragma DATA _CONFIG4L,11000000b //mmm... check this one that was the problem. i had the "Extended Instruction Set" Enabled.... And after r-ing tfm... Enabling the PIC18 extended instruction set (XINST Configuration bit = 1) significantly changes certain aspects of data memory and its addressing. sounds familiar... Man... i feel dumb. i mean... that comment was there since the day i started putting this app together.
  8. Ok... Here's what i've figured out so far. It's got NOTHING to do with serial. How do i know ? The following is the entirety of my code right now... #include <system.h> #pragma DATA _CONFIG1L, 00111100b #pragma DATA _CONFIG1H, 00001110b #pragma DATA _CONFIG2L,00111000b #pragma DATA _CONFIG2H,0 //disable WDT #pragma DATA _CONFIG3H,0 #pragma DATA _CONFIG4L,11000000b //mmm... check this one #pragma CLOCK_FREQ 16000000 void main() { trisa=0; char idx=0; char booger[9] = {1,2,3,4,5,6,7,8,9}; while (true) { porta=booger[idx]; if (idx==8) idx=0; else idx++; delay_s(1); } } and what do i get on porta ? the same gibberish that was being fed to putc in my last posting. if i change it to porta=idx, i get the expected results. And of course, stepping thru with the debugger gives the expected results. I've tried this code with three different 4450's. Note that when i say gibberish, it is BS numbers, but consistent. this is why i think it's reading the wrong memory or something. I don't have any other 18F's to mess with... the 4450 was my 18F-intro-chip. :-/ I'm going to take a look at the 4450's include... I remember there being some differences between it and the 4550 that could have been overlooked. That and i'll try my hand at comparing some asm, but not having any experience with asm that'll be a challenge. On the other hand, i'm hoping this is some extremely dopey screwup on my part. :-/
  9. I've got an odd problem which i've whittled down to the following applicable code: #include <uhw4450.h> #include <system.h> #include <miniuhw.h> #include <sLCD.h> #pragma DATA _CONFIG1L, 00111100b #pragma DATA _CONFIG1H, 00001110b #pragma DATA _CONFIG2L,00111000b #pragma DATA _CONFIG2H,0 //disable WDT #pragma DATA _CONFIG3H,0 #pragma DATA _CONFIG4L,11000000b //mmm... check this one #pragma CLOCK_FREQ 16000000 void main() { uart_init(1,103); //9600@16mhz // delay_s(2); trisa=0; // putc('\r'); putc('\n'); // putc('T'); putc('E');putc('S'); putc('T'); // putc('\r'); putc('\n'); // delay_s(1); while (true) { puts("FART"); delay_s(1); } } i've got a titload of putc's in there because... puts is giving me gibberish on my 18f4450. (NOT 4550... 4450. Doubt that it matters, but that's a common mixup.) I step thru it on debug, and it acts as it should. I've used the puts defined in the rs232 header and this one: void puts( const char* str ) { char c; char i; for( i = 0; c = str[ i ]; i++ ) putc( c ); putc(0x0d); putc(0x0a); } I should note that my putc's work perfectly... if i make a loop with 100 putc's in a row, no delays, it will all work fine. I'm not too good on my pointers/*/& and whatnot... but i've tried all the various combos i can think of. All it spits out is this: Bx?Q@E?P ?0 Bx?Q@E?P ?0 Yeah. Somehow, my "FART" is being messed up, as if im giving it a pointer where it wants data or vice versa, but it's the same puts() everyone else uses... so i don't get it ! Thanks in advance !
  10. got it sorted. forgot that start bits are 0. duh. so on the transmit side, PIC was trying to send a start bit, which will not illuminate the LED. on the receive side, i was pulling Rx pin low. always getting a start bit, never getting data. pull the Rx pin high, and BAM... we're in action. That and i tweaked my code a bit so on the Rx side of things, i'm always checking for data more often than the Tx side is spitting it out. Handy dandy. *moves on to next project*
  11. #pragma DATA _CONFIG, _XT_OSC & _WDT_OFF & _CP_OFF & _PWRTE_OFF this sets up an external oscillator. If that's not your intent, replace _XT_OSC with _INTOSCIO (for the 616) and you should be good to go. Note that i haven't looked at the code or anything the manual for the 616 is right here (if you don't already have it): http://ww1.microchip.com/downloads/en/DeviceDoc/41288A.pdf they are awesome.
  12. All that being said, i will add on that creating a simple "write" function like this: void write() { char d=0; for(;;d++) { putc(d); if (d==255) d=0; delay_s(1); } } does nothing for me right now. I hook up an LED to tx, and it does not flash.
  13. BoostC 6.91, 16F690, 8MHZ, etc... I'm going to try and set this up using the hardware, which i've avoided since i've read that setting it up for a eusart is fairly different. And that's moot, i should be able to get this to work using software . Ok, here's the code: // **** START OF DEFAULTS USED FOR SOFTWARE USART EMULATION **** unsigned short sw_SPBRG@0x47; // define location for the emulated SSPCON1 unsigned short sw_RCREG@0x48; // define location for the emulated SSPCON2 unsigned short sw_TXREG@0x49; // define location for the emulated SSPSTAT unsigned short sw_TXSTA@0x4A; // define location for the emulated SSPBUF unsigned short sw_RCSTA@0x4B; // define location for the emulated SSPADD unsigned short sw_TXIF_PIR@0x4C;// define location for the emulated TXIF_PIR1 unsigned short sw_RCIF_PIR@0x4C;// define location for the emulated RCIF_PIR1 //////////////////////////////////////////////////////////////////////////// // USART software implementation template argument values //////////////////////////////////////////////////////////////////////////// #define TX_PORT PORTA #define TX_TRIS TRISA #define TX_BIT 1 #define RX_PORT PORTA #define RX_TRIS TRISA #define RX_BIT 0 #define e_SPBRG 0x47 #define e_RCREG 0x48 #define e_TXREG 0x49 #define e_TXSTA 0x4A #define e_RCSTA 0x4B #define e_TXIF_PIR 0x4C #define e_RCIF_PIR 0x4C #define e_TXIF_BIT 4 #define e_RCIF_BIT 5 #define MODE (0)//don't care about inverts or WDT, and it's not hardware #define bit_time 417 //4800 baud at 8mhz, right ? #pragma CLOCK_FREQ 8000000 #pragma DATA _CONFIG, _FCMEN_OFF & _IESO_OFF & _BOR_ON & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO #include <system.h> #include <rs232_driver.h> void read() { char d=0; for(; { while(!kbhit()); //d=getc(); portc=255;//d; delay_ms(250); portc=0; delay_ms(250); } } void main() { ansel=0; anselh=0; trisc=0; //portc out to LEDs. osccon.IRCF0=1;//up oscillator to 8mhz. uart_init(0,0); //dummy vals. read(); } Portc is connected to LEDs. there are no other connections made other than ICSP. The problem is.... i have nothing connected to A0 (other than pulling it to ground) and it flashes the LEDs. If i pull it to +v, it still flashes. kbhit is... being... hit... somehow. I figured i'd post here to see if i'm doing something stupid before diving into it and hacking up code that's not even mine... Especially considering that i'm just now learning uart stuff and all. Typically, i'll get something working, whether or not i understand it, and THEN go through it bit by bit optimizing/tweaking/learning from it. Thanks in advance for any help, and i apologize if my information is incomplete in any way. Beleive me, if i need to supply phone numbers, photos or video to get this solved i will... I've spent 2 days reading prior posts on the forums trying to figure this out.
  14. This is not really about porting so much as learning the ins and outs of BoostC. I'm used to CCS's free-PCB, in which if you say something like: PORTB=6; *PORTB=128; your code will work like a gem and whatnot. I don't mind the volatile char portb@6; way of doing things for ports....... BUUUUUUUT. i'm looking for a way to represent a pin as a byte, the likes of PORTB*8+5; that is to say, it is the 53rd bit. if nothing else one can break this down into it's port/pin "meaning", for instance: char pimp[]={PORTB*8+5,PORTC*8+3}; char port = (pimp[0]/8); char pin = (pimp[0]%8); i'm aware of the functionality of representing a pin as a volatile..... volatile bit PIN_B1@6.1; but as far as i can see there's no way of putting a PIN_B1 such as this into an array, much less "wrapping" it and then putting it into an array.... being a bit and all. certainly there must be some simple way of making an array of pins that i am overlooking ? What i've done in the past has been to create an array of bytes... hmmmmmmmmmmmmmmmm i just got an idea.... it's clever but a bit complicated. anyway, anyone who's done this please let me know. i'm doing this for things like 7seg drivers, lcd drivers, etc. i don't like hard-coding stuff, and the idea of setting up the variables, and leaving them for the user to define is a wee bit too close to hard coded for my likes. *particularily* when i'm used to coding the likes of a 10f200 and 12f508.... tiny. and i've always managed to make my code portable... for the most part. for instance, say if i were to be using the same compiler between a 10f200 and a 16f610. former has ONLY portb.... latter has *no* portb. if i've hard-coded it, what then ? yeah i'm rambling now... i'll shut up.
  15. yeah, LEDs on all pins. the ASM is fine... the c isnt. i forgot anselh=0; i'm an idiot. well no im not. im porting code when i should be sleeping, that's what i am. the 610 doesnt have anselh. i should've figured this out before, i've actually done this once already, but the symptoms were different. i was adding some features to a 610 project, upgrading it to a 690. the new features were on c6 and 7 which were not acting properly. WHY !?!?!? c6 is an8 c7 is an9 both are on anselh. i am learning. lol. THANK YOU.
  • Create New...