[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

#include<C General.h>

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 14
Thread images: 1

C Programming thread
>>
>>58606832
is Programming in C by Kochan a good book for a noob?

Also how can I learn about debugging, reverse engineering, disassembling, etc?
>>
>>58607760
>is Programming in C by Kochan a good book for a noob?
yes

>>58607760
>Also how can I learn about debugging, reverse engineering, disassembling, etc?
you'll know how to do all of this and more when you're no longer a noob. practice the things you want to learn.
>>
>>58607760
>is Programming in C by Kochan a good book for a noob?
the best book is the book you work through and do all the practice problems.
>>
Why haven't you guys upgraded to C++ yet?
>>
>>58607859
we are aware of C++'s many advantages in specific scenarios. this is a thread about programming in C.
>>
i'm trying to blink the led's on a TI MSP-EXP430G2. Using Linux packages, etc. Getting the following error:
make
msp430-elf-gcc -Os -Wall -g -mmcu=msp430x -c main.c
main.c:30:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
void main(void) {
^
In file included from /opt/ti/mspgcc/msp430-elf/include/msp430g2553.h:120:0,
from main.c:19:
main.c: In function ‘main’:
main.c:40:20: error: expected expression before ‘__asm__’
__bis_SR_register(LPM0 + GIE); // LPM0 with interrupts enabled
^

....


this means there is an error with the header files I installed via my package manager, correct? What is the best way to get this fixed?
>>
>>58608119
Post code of invocation and function declaration please. What's the type of variables declared?
>>
>>58608119
 int main(void) {
...
...
return 0;
}

will fix the compiler errer, but it may be caused by something else
>>
>>58608267
//#include <msp430g2553.h>    // chip on board has M430G2553 on it.
#include <msp430xgeneric.h>
#include <signal.h> // not sure what this is for

// Need some define statements for the LEDs... not sure how to figure this out
// Copying from other program, but on board P1.0 says LED1, and P1.6 says LED2
#define LED0 BIT0
#define LED1 BIT6
#define LED_DIR P1DIR
#define LED_OUT P1OUT

// I don't understand |=, which is Bitwise inclusive OR and assignment operator.
void main(void) {
WDTCTL = WDTPW + WDTHOLD; //Stop watchdog timer?
LED_DIR |= (LED0 + LED1); //Set LED pins as outputs
LED_OUT &= ~(LED0 + LED1); //Turn off both LEDs

CCTL0 = CCIE;
TACTL = TASSEL_2 + MC_2; //Set the timer A to SMCLCK, Continuous

__enable_interrupt();

__bis_SR_register(LPM0 + GIE); // LPM0 with interrupts enabled
}

// Timer A0 interrupt service routine. No idea what pragma is
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void) {
timerCount = (timerCount + 1) % 8;
if(timerCount == 0)
P1OUT ^= (LED0 + LED1);
}
>>
>>58608298
This is silly, but putting a return; at the end of main, wouldn't do anything would it?
>>
>>58608386
it wouldnt make the function behave differently
>>
>>58608298
LED_DIR |= (LED0 + LED1);

means LED_DIR becomes equal to the bitwise OR of LED_DIR and (LED0 + LED1)

#pragma is a directive to the compiler. it isnt standard C but compiler specific.
>>
>>58608386

i notice the small warnings, etc. but I am trying to figure out if it is something in my program or a problem with the headers included with the package i got them from.
Thread posts: 14
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.