Jump to content

Smache

EstablishedMember
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Smache

  • Rank
    Regular
  1. From your code I see that you choosed low nibble 4 bit interface: #define LCD_ARGS 1, /* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \ 1, /* Use busy signal: 1 = use busy, 0 = use time delays */\ PORTC, TRISC, /* Data port and data port tris register */ \ PORTA, TRISA, /* Control port and control port tris register */ \ 3, /* Bit number of control port is connected to RS */ \ 2, /* Bit number of control port is connected to RW */ \ 1 /* Bit number of control port is connected to Enable */ So you have to connect the data signals to DB0...DB3 or if you have them already wired to DB4..DB7 you have to change the first LCD_ARGS to 2 (upper nibble).
  2. You haven't rebuilt the project or haven't reloaded the new .hex file into your programming software I would guess, so you are programming with the old code. Regards Dave <{POST_SNAPBACK}> If you use the h/w UART you have to change parameters in uart_init function, the bit_time is irrelevant in this case.
  3. I don't know about MSVC but Keil gives the result I expected, that is 0xF0=(~0x0F). In my example var3=0xAA;
  4. Bug description: Wrong result whith ~ operator when included in a logical expression. Steps to reproduce: #include <system.h> void main(void) { unsigned char val1,val2,val3; val1=0xF0; val2=0x0F; if(val1==(~val2)) val3=0xAA; else val3=0xBB; } Asm output: 0003 main 0003 ; { main; function begin 0003 30F0 MOVLW 0xF0 0004 1283 BCF STATUS, RP0 0005 1303 BCF STATUS, RP1 0006 00A1 MOVWF main_1_val1 0007 300F MOVLW 0x0F 0008 00A2 MOVWF main_1_val2 0009 01A5 CLRF CompTempVar303 000A 0922 COMF main_1_val2, W 000B 00A4 MOVWF CompTempVar302 000C 09A5 COMF CompTempVar303, F 000D 0821 MOVF main_1_val1, W 000E 0624 XORWF CompTempVar302, W 000F 1903 BTFSC STATUS,Z 0010 0825 MOVF CompTempVar303, W 0011 1D03 BTFSS STATUS,Z 0012 2816 GOTO label268437633 0013 30AA MOVLW 0xAA 0014 00A3 MOVWF main_1_val3 0015 0008 RETURN 0016 label268437633 0016 30BB MOVLW 0xBB 0017 00A3 MOVWF main_1_val3 0018 0008 RETURN Expected behaviour: val3=0xAA instead of val3=0xBB; Is the problem 100% reproduceable: Yes. IDE version: SourceBoost IDE version 6.55 Compiler: BoostC Compiler version: 6.55 Target device: PIC16F648A OS: Windows XP
  5. rfhaley, I think your function CheckBright() is not correct: void CheckBright(void) { // if (maxht > 150) clk = clk - 40; // WAAY Too Bright if (maxht > 60) clk = clk - 20; // Far Too Bright if (maxht > 45) clk = clk - 10; // Too Bright if (maxht > 30) clk = clk - 4; // a bit Too Bright if (maxht < 24) clk = clk + 4; // a bit Too Dim if (maxht < 15) clk = clk + 7; // Too Dim if (maxht < 10) clk = clk + 10; // Much Too Dim if (clk < 5) { ouch = true; } // Limit clock high speed for A2D else { ouch = false; // OK when clk rises } }//END CheckBright You don't check clk against under or overflow. Your initial value of clk is 50. If maxht>30 eventualy clk will underflow and have a large value. And if maxht<24 clk will increase but it will take a much longer time to overflow.
  6. If you are using pic16f688 you have to put in HWInit() cmcon0 = 0x07 and ansel = 0 to configure PORTC pins as digital I/O.
  7. You have to add libc.pic16.lib from the Lib folder of SourceBoost directory in Library Files of Mplab project.
  8. You don't say what microcontroller is used but if RA4 is an open-drain output you have to put a pull-up resistor to pin RA4 in order to get the push button working.
  9. SourceBoost 6.31, BoostC, Windows XP #include <system.h> void main(void) { char* string; string="0123456789"; string="abcdefghij"; string="klmnopqrst"; while(1); } Asm output: Why different temporary strings (CompTempVar52, CompTempVar53, CompTempVar54) for the same string variable?
  10. Instead of adcon0=0 put adcon1=6 (make all five analog imputs of PORT A digital I/O);
  11. It's a simulator bug or something? <{POST_SNAPBACK}> In eeprom_read function use eedata instead EEDATA.
  12. It's page 6, TABLE 1-1: PIC16F630/676 PINOUT DESCRIPTION.
×
×
  • Create New...