Buy Cialis Mexico! Only Top Quality Tabs



Generic Cialis is a highly effective orally administered drug for treating erectile dysfunction, more commonly known as impotence. Recommended for use as needed, Cialis can also be used as a daily medication.

Cialis online bestellen erfahrung cialis online kaufen empfehlung buy clomid in germany cheapest cialis tablets valtrex tem generico order cialis online without prescription. How much is the generic valtrex buy clomid in london hoodia gordonii uk holland and barrett cialis online rezept bestellen. Buy cialis online without prescription cheapest prescription cialis nombre generico de valtrex over the counter generic valtrex. Ditropan drug uses buy clomid supplement ditropan xl drugs.com cialis online prescription order buy clomid from uk hoodia diet pills holland barrett. Propecia in uk propecia uk online yasmin pill buy online u.k cialis online rezeptfrei kaufen ditropan xl drug buy clomid and nolvadex uk. Inderal over the counter uk cheapest cialis without prescription what cheaper cialis or viagra where to buy cialis without prescription. Buying cheap cialis online cialis tabletten online kaufen yasmin pill buy online buy 150 mg clomid propecia prescription uk cost. Cialis online bestellen eu nombre generico del valtrex Cialis 360 Pills 20mg $555 - $1.54 Per pill cialis generika online bestellen erfahrungen. How much does valtrex generic cost buy yasmin online usa yasmin pill online buy propecia uk best price valtrex generico precio buy clomid australia online. Drug store online cialis online kaufen express buy cialis online with a prescription Is canadian generic cialis safe cialis online no prior prescription. Cheap cialis prescription valtrex and generic valtrex generic cialis uk cheap buy leftover clomid buy safe clomid. Buy clomid serm buy cialis without prescription buy yasmin pill usa yasmin pill to buy online is cialis cheaper than viagra. Propecia cost in uk cialis online kaufen in deutschland valtrex 500mg generic cialis generika online kaufen ohne rezept is propecia safe uk ditropan xl drug interactions. Propecia order uk cialis kaufen online rezept propecia uk prescription order propecia uk cialis online bestellen tipps buy yasmin in usa valtrex generic pill valtrex and generic. Buy yasmin contraceptive pill online uk is there generic valtrex which is cheaper cialis or viagra ditropan drug class valtrex authorized generic buy cialis online prescription. Buy clomid in the uk cialis cheapest price australia cheap cialis price buy natural clomid.

Cialis 180 Pills 20mg $345 - $1.92 Per pill
Cialis 60 Pills 20mg $179 - $2.98 Per pill



OrangePrince RupertGreater VancouverWollongongMackay
Saint AnsgarPresidioAmanaAbbevilleSouthern Pines
KalkarNiddatalWesterburgSchwarzenbornFriedrichsthal


How much does cialis cost in ireland Finasteride 5 mg order online Buy furosemide 40 mg online Vardenafil tablets dosage Meldonium buy usa


  • cheap cialis mexico
  • cialis online mexico
  • precio de cialis 10 mg en mexico
  • purchase cialis in mexico
  • buying cialis from mexico
  • buy cialis in mexico
  • buying cialis in mexico


Plavix medication uses generic viagra cialis canada cialis for sale online in canada generic viagra cialis online pharmacy caverta 100 mg india. Caverta 100 mg price in india caverta dosage generic cialis 20mg online caverta 100 mg tablets cialis 20 mg for sale. Cialis 40 mg for sale buy cialis with priligy online caverta 100 dosage Cheap cialis mexico caverta 25 dosage is amlodipine available over the counter. Diflucan cost ireland buy cialis australia online caverta 100 mg dosage plavix medication cost plavix medication contraindications. Tretinoin cream .1 online plavix medication dosage tretinoin buy online australia cialis purchase canada. Plavix medication price generic cialis for sale cialis 10 mg canada generic cialis for sale online Cialis 30 Pills 50mg $175 - $5.83 Per pill. Buy cialis 10mg online amlodipine 5mg over the counter tretinoin 0.05 online buy trental uk cialis 10mg price in canada. drug store online shopping cialis for sale in the usa cialis 20 mg price canada non generic cialis online tretinoin online kaufen is amlodipine an over the counter drug. Caverta 100 mg video caverta 100 mg reviews buy diflucan online ireland caverta 100 mg ranbaxy buy caverta 100 mg online caverta 50 mg effects. Viagra cialis levitra canadian pharmacy plavix medication class cheap cialis for sale tretinoin .1 online caverta 50 mg kopen generic viagra cialis online. Caverta 50 mg online in india caverta 25 mg price in india can i buy diflucan over the counter in ireland viagra cialis levitra for sale. Tretinoin creme online kaufen plavix medication classification cialis for sale winnipeg can you buy amlodipine over the counter is amlodipine available over the counter. Tretinoin buy online uk cheapest cialis 20mg online cialis 20 mg from canada cheap viagra cialis online cialis 40 mg canada. Amlodipine over the counter uk diflucan northern ireland order cialis from canadian pharmacy diflucan thrush ireland. Buy caverta 100mg online cialis and viagra for sale tretinoin cream 0.1 online pharmacy caverta 25 mg dosage cheap generic cialis for sale. Tretinoin cream 0.05 online caverta 25 mg tablet use of caverta 25 mg is diflucan available over the counter in ireland generic cialis canada online. Dosage of caverta diflucan tablets ireland caverta 100mg price caverta 100 mg tab diflucan otc ireland cialis for sale in australia. Kopa tretinoin online amlodipine over the counter uk cialis for sale cheap caverta 50 mg ranbaxy buy cheapest cialis online. Order cialis canadian pharmacy amlodipine besylate over the counter cheap 40 mg cialis online cialis canadian pharmacy online caverta 50 mg price in india. Trental online buy diflucan over the counter ireland diflucan price ireland.

  • Cialis in Mesa
  • Cialis in Tenn.
  • Cialis in Norfolk
  • Cialis in Santa rosa
  • Cialis in North las vegas


Cialis mexico pharmacy what is ciprogen tablets used for ciprofloxacin hydrochloride tablets i p 500 mg zocor simvastatin price. Buy generic acyclovir online ciprofloxacin tablets contents ciprofloxacin tinidazole tablets ciprofloxacin tablet reviews buy cialis online uk price of zocor. Ciprofloxacin 500 mg tablets used for zocor vs lipitor price compra de cialis generico en mexico cheap cialis tablets uk price of zocor at walmart. Orlistat teva 120 mg kopen Cialis 40 Pills 100mg $265 - $6.63 Per pill ciprobay 500 mg filmtabletta ciproxin ciprofloxacin tablets. Alli orlistat kopen cialis generico en farmacias similares mexico is cialis available over the counter in mexico ciprofloxacin hydrochloride tablets dosage. Cipro tablet kullananlar orlistat 120 mg kopen generic zocor price walmart cialis generico farmacias similares mexico ciprofloxacin tablets bp monograph. Generic diflucan 150 mg dostinex drug.com generic diflucan otc cipro tablets 500mg ciproxina tabletas para que sirve buy cialis 5mg online zocor price at walmart. Paroxetine hcl 40 mg tablet para que sirve la ciprofloxacino tabletas de 500 mg zocor price philippines ciprofloxacin tablets price cipro tablets. Price of generic diflucan buy cialis viagra online uk buy cialis online uk zocor 10mg price ciproxin 500 tablet use orlistat kopen belgie. Cialis over the counter mexico buy cialis 2.5 mg online Best price tretinoin 0.05 cream cipro tz tablet ciprofloxacin 500 mg tablet dosage. Cialis buy online is cialis sold over the counter in mexico dostinex drug interactions ciprofloxacin tablets dissolution ciprofloxacin genrx tablets. Ciprofloxacin tablets in india buy cialis england ciprofloxacin 500 mg tablets information ciprofloxacin tablets indications ashwagandha tablets for weight loss. Dostinex fail drug test paroxetine and sleeping tablets ciprofloxacin tablets wiki zocor 10 mg price generic for diflucan 150 mg. Ciprofloxacin tablets ip ciprodac 500 antybiotyk cipronex a tabletki antykoncepcyjne cena tabletek cipronex ciproglen 500 tabletas can i buy cialis in mexico. Amoxicillin 500mg for sale quien vende cialis generico en mexico.

Harpers FerryTauntonDurhamClintonCialis DightonCialis AveryHillsboroHarrisonTallassee


Safe online pharmacy for clomid Can i buy viagra over the counter in france Buy dapoxetine in canada Alli orlistat acquisto on line Viagra generico 100 mg preço


Cost of cialis online kamagra oral jelly vrouwen kamagra oral jelly vs tablets provigil medication ingredients. Cost of cialis for bph kamagra oral gel kaufen viagra with prescription uk is strattera sold over the counter cialis 5 mg quanto costa in farmacia. Cialis generika online kaufen erfahrungen buy cialis england viagra from pharmacy uk cialis dosage cost where to buy cialis over the counter uk kamagra oral jelly im laden kaufen. Viagra prescription cost uk provigil add medication buy cialis tadalafil uk kamagra oral jelly best price wo kann man seriös kamagra kaufen kamagra in polen kaufen. drug store delivery los angeles cialis online bestellen erfahrungen where to buy cialis in mexico provigil medication weight loss. Provigil medication guide viagra private prescription cost uk provigil medication class viagra prescription uk cialis kaufen online rezept viagra pharmacy prices uk. Wo kamagra seriös kaufen cialis online bestellen tipps buy cialis london provigil medication and adhd provigil adhd medication cialis online kaufen mit rezept. Can strattera be bought over the counter cialis online rezeptfrei kaufen cialis pharmacy cost cialis online rezept bestellen viagra private prescription uk. Cialis generika online bestellen erfahrungen buy cialis online uk provigil depression medication cheap cialis 5mg uk. Provigil medication narcolepsy crestor rosuvastatin medicine import viagra to uk how much does cialis cost in uk kamagra oral jelly nl. Canadian pharmacy viagra uk kamagra oral jelly cost viagra off prescription uk provigil medication interactions buy cialis 5mg online uk. Kamagra oral jelly seriös kaufen provigil medication mechanism action kamagra oral jelly na srpskom cialis online bestellen auf rechnung. Kamagra oral jelly brisbane viagra on prescription uk does viagra need a prescription in uk super kamagra original kaufen. Non prescription viagra in uk cialis online kaufen express kamagra oral jelly apotheke kaufen kamagra oral jelly vanilla cheap cialis tablets uk. Cost of cialis in uk cialis costs uk cialis 5mg 30 tablet cost kamagra oral jelly box cheap cialis 20mg uk kamagra oral jelly virkning viagra prescription free uk. Kamagra kaufen in frankfurt is strattera over the counter kamagra preiswert kaufen kamagra oral jelly benefits provigil for depression medication. Can you get strattera over the counter cialis buy uk crestor medicine dosage provigil medication and weight loss cialis generika online kaufen ohne rezept cialis cost at pharmacy. Kamagra oral jelly in polen kaufen cialis online kaufen in deutschland cialis online bestellen in deutschland cheap genuine cialis uk.

can you buy cialis in mexico
drug store online uk
drug store online coupon
drug stores in canada online
drug store sodo seattle
best online drug stores canada
pharmacy online shop ireland
drug store online usa
can you buy cialis over the counter in mexico
drug store west seattle


< Comprar hoodia gordonii online :: Buy generic clomid online >

C Preprocessor Macro Demo Video

Here is a demo video on using C Preprocessor macros to make your code easier to read and write.

As promised, here is the code in the demo program

And don’t forget to check out the original articles

http://www.mybitbox.com/2012/11/robust-c-code-part-1-c-preprocessor/
http://www.mybitbox.com/2012/12/robust-c-code-part-2-advanced-c-preprecessor/
http://www.mybitbox.com/2012/12/robust-c-code-part-3-wrapping-c/

S1axter

Gerbmerge issues on Ubuntu 12.10

Gerbmerge is used to panelize multiple PCB gerber files into one gerber.  This allows you to submit one “board” that has multiple copies on it.  Note, gerbmerge was developed for Eagle PCB generated gerber files

Installing gerbmerge on Ubuntu 12.10 (Actually Xubuntu 12.10, but things should be the same with regular Ubuntu) didn’t work right out of the box, here is what needs to be modified:

Edit setup.py from gerbmerge 1.8 source: Change line 40:

From: DestLib = distutils.sysconfig.get_config_var(‘LIBPYTHON’)
To: DestLib = distutils.sysconfig.get_python_lib()

Run sudo python setup.py install

Check the ‘installed_file’ file and see where gerbmerge was installed, mine was “/usr/local/lib/python2.7/dist-packages/gerbmerge/gerbmerge.py”

Edit /usr/bin/gerbmerge to point to this location. The “installed_files” file will also tell you where the testdata was installed.

Source: Installing on a Mac: http://karplus4arduino.wordpress.com/tag/gerbmerge/

ARM cross compiling in 5 minutes

I was poking around tonight and started playing with some ARM cross compiling on my x86 Xubuntu 12.10 desktop via QEMU.  If you want to start building for ARM, follow these steps

Using Synaptic install “gcc-4.6-arm-linux-gnueabi”,”qemu-kvm”,”qemu-kvm-extras” and all the dependencies. (Maybe someone can post the full “apt-get install” command as a comment)

Make a small C file.  Example

#include<stdio.h>
int main(){
printf(“Hello ARM World\n”);
}

Build the binary: “arm-linux-gnueabi-gcc-4.6 hello.c -o hello”

Run the ARM binary using Qemu via “qemu-arm -L /usr/arm-linux-gnueabi/ ./hello”

Should output “Hello ARM World”

Pretty easy, now you have an ARM cross compiler toolchain.

Useful QEMU ARM links:

http://www.linuxforu.com/2011/06/qemu-for-embedded-systems-development-part-1/
http://www.cnx-software.com/2011/02/10/emulate-an-arm-plaform-with-qemu-on-ubuntu-10-10/
http://wiki.debian.org/QemuUserEmulation

 

Nixie clock demo

The latest project, a nixie clock, is almost done! Just needs a few more tweaks and a replacement driver chip for the left most digit.

Robust C Code Part 3 – Wrapping C

In the last segment in this series “Robust C Code Part 2 – Advanced C Preprocessor” I talked about the preprocessor concatenation directive.  In this segment I will talk about using the preprocessor to wrap C code, and what an L-value is. Now this is getting a little technical, so you might want to brush up on C.

The macros I defined in parts 1 and 2 of the series are rather simple. Many times I want to wrap multiple C statements in a macro and use them just as a regular statements.  This seems rather straight forward we could do the following

#define setup_some_hardware()            hw_register1=0x12;hw_register2=0x34;hw_register3=0x56

This will work most of the time since the statements are executed one after another, however this is dangerous because the statements are not grouped in the same scope.  You can think of scope as groups of variables that can ‘see’ each other.  If you have 2 functions, one with ‘int x’ inside and one with ‘int y’ inside, the variables can not ‘see’ each other since they are are in different functions, which means you can’t do x=y; they exist in different scope. A new scope can be created with curly braces {}, which means loops, if statement  and functions all have their own scope.  The three statements in the previous macro can exist in different scopes like in this example:

// Check the hardware and enabled if off
if(HWREGISTER.ON == false)
setup_some_hardware();

An if() statement without curly braces {} will execute the single next statement if the condition is true.  This causes a problem because the preprocessor expands the macro to:

// Check the hardware and enabled if off
if(HWREGISTER.ON == false)
hw_register1=0x12;hw_register2=0x34;hw_register3=0x56

This results in hw_register2 and hw_register3 ALWAYS being set and only hw_register1 affected by the if() statement.  In C you can’t have semicolons in parentheses, so what do you do to group the statements?  One solution is to add curly braces {} to macros that don’t return a value so all statements are in the same scope.  This seems logical however in C you can’t have a semicolon after a brace which means you have some statements with semicolons and some without, which can lead to some really hard to find bugs.

The solution for this problem is to wrap the multiple statements in do{ }while(0).  If you took  CS101, the do{}while() loop will always allow one execution before evaluating the condition in the while().  Since while(0) is always false any good ANSI C preprocessor will remove the do{}while(0) and only execute the code once.  Since the loop uses curly braces to create a new scope, all statements are in the same scope and a semicolon can be used on the statement.

#define setup_some_hardware()            do{hw_register1=0x12;hw_register2=0x34;hw_register3=0x56;}while(0)

// Check the hardware and enabled if off
if(HWREGISTER.ON == false)
setup_some_hardware();

An additional benefit of the scope created by the do{ }while(0) is that new variables can be created in the new scope.

#define swap_int(val1,val2)              do{int tmp; tmp=val1; val1=val2; val2=tmp;}while(0)

if(some_condition)
swap_int(x,y);

A little known/understood element in C is the L-value. L-values can be though of as the value returned from the right side of a C statement to the left side of the statement. a do{ }while() loop has no L-value and will result in a compiler error if an L-value is expected, so any statement that returns a value should NOT use do{ }while(0) wrapping.  A good rule of thumb is if the statement returns a value use parathenses, if it doesn’t, use do{ }while(0).

The following is an excerpt from a UART C header which uses the preprocessor to give more developer friendly names to sequences of statements and convoluted register names:

#define uart1_interrupt_rx_enable()      do{IEC0bits.U1RXIE = 1;}while(0)
#define uart1_interrupt_rx_disable()     do{IEC0bits.U1RXIE = 0;}while(0)
#define uart1_interrupt_rx_clear()         do{IFS0bits.U1RXIF = 0;}while(0)
#define uart1_interrupt_rx_set()             do{IFS0bits.U1RXIF = 1;}while(0)
#define uart1_interrupt_tx_enable()      do{IEC0bits.U1TXIE = 1;}while(0)
#define uart1_interrupt_tx_disable()     do{IEC0bits.U1TXIE = 0;}while(0)

#define uart1_tx_buffer_full()              (U1STAbits.UTXBF == 1)
#define uart1_tx_last_done()               (U1STAbits.TRMT==1)
#define uart1_rx_overrun_get()           (U1STAbits.OERR)

#define uart1_reset()             do{U1MODE = 0;U1STA = 0;}while(0)
#define uart1_enable()         do{U1MODEbits.UARTEN = 1;}while(0)

 All the preprocessor macros that I have shown will compile down into “in line” instructions.  This speeds up execution compared to functions since the processor doesn’t have to create a stack frame and branch to another location in code just to do a simple bit set.  The one downside is highly used macros with multiple statements will be injected into the source each time they are used, which can lead to larger code.  I try and keep preprocessor macros short and simple to reduce this.

Nixie test

Here is a short video of the nixie tube clock with the first nixie tube connected.  The controller board uses a PIC24FV32KA302 processor, a 74HC595 shift register, a 74LS374 octal latch and 74141 driver chip to control an IN-14 nixie tube.

Check back for more on the clock.

Been there

I have been there…

Robust C Code Part 2 – Advanced C Preprecessor

I my last post ‘Robust C Code Part 1 – C Preprocessor‘ I talked about the C preprocessor and how it can be used to hide registers from the user without adding code space for lots of functions.  In this post I will talk a little more about the preprocessor and some of the more advanced features.

The C preprocessor also takes arguments, just like functions.  Take a look at this example

#define days_in_years(value)        (365*value)

int x,y,x;
x = days_in_years(1);
y = days_in_years(10);
z = days_in_years(65);

This code works similar to the code in the first post, it replaces days_in_years(value) with (365*value), the text ‘value’ is replaced with the argument to result in (365*1), (365*10) and (365*65). The C preprocessor isn’t just a copy and paste tool for strings of text, in addition to direct replacement of text the preprocessor allows concatenation of strings using the ‘##’ directive.  Take the following example:

// Allow PortA, pin 1 to be accessed with led1() macro
#define led1(func)  porta_pin_1_##func

// PIC24 PortA pin 1 register macros
#define porta_pin_1_output()               (TRISAbits.TRISA1 = 0)
#define porta_pin_1_input()                (TRISAbits.TRISA1 = 1)
#define porta_pin_1_high()                 (LATAbits.LATA1 = 1)
#define porta_pin_1_low()                   (LATAbits.LATA1 = 0)

This example uses the same port macros as part 1 of this series.  The new line is how to hide register access and name pins in a more developer friendly way.  Read over the next part a few times, I will take it one step at a time.

First the ‘##’ in the macro is the concatenation directive for the preprocessor, it says we should take the argument ‘func’ and replace ‘##func’ with whatever we passed in.  Lets say we have the following in our C code:

led1(somejunktext);

This would replace ‘##func’ in the macro with ‘somejunktext’ and concatenate the text string ‘porta_pin_1_’ with ‘somejunktext’ to make a new sequence of text:

porta_pin_1_somejunktext;

Now, this result is very similar to the format of the pin macros we have listed above, but instead of ‘somejunktext’ the ‘porta_pin_1_’ is followed by ‘output()’, ‘input()’, ‘high()’ and ‘low()’.  Because the preprocessor does direct text replacement you can have these strings of characters as arguments:

led1(output());
led1(high());

This results in:

porta_pin_1_output();
porta_pin_1_high();

Which turns into:

TRISAbits.TRISA1 = 0;
LATAbits.LATA1 = 1;

The really nice thing about using preprocessor string concatenation  is you can switch all references to a pin very quickly with just changing the directive:

// Allow PortA, pin 1 to be accesses with led1() macro (Not used)
//#define led1(func)  porta_pin_1_##
// Allow PortA, pin 4 to be accesses with led1() macro (Now this is on pin 4 and all the code still works)
#define led1(func)  porta_pin_4_##

Now, to really blow your mind, you can use multiple concatenation operators in a single macro, which can allow for lots of macros without the code space required for a function:

#define porta_pin_high(pinnum)       porta_pin_##pinnum##_high()
#define porta_pin_low(pinnum)         porta_pin_##pinnum##_low()

porta_pin_high(1);
porta_pin_high(2);
porta_pin_low(3);
porta_pin_low(4);
porta_pin_high(5);

Multiple concatenation makes the set function I mentioned in part 1 of the series really easy:

#define pin_output(portname,pinnum)       ##portname##_pin_##pinnum##_output()

pin_output(porta,1);
pin_output(portb,2);
pin_output(portb,7);

Take a look at this example of a header file for the PIC24 microcontroller for an idea of what can be done with this technique.

Nixie boards

So the nixie boards are in.  I used iTeadStudios from China to make a few daughter boards that hold 2 nixies, 2 74141 driver chips and a 74LS374 octal latch.  Using a 374 latch and the 74141 chips allow me to write an 8-bit value to the boards and latch it in.

The boards are 5cm by 5cm and cost <$2 each from iTead since I got 10. Shipping took about a month, so if you plan on using them, plan accordingly.

The daughter boards are attached to a controller board with a PIC24FV32KA302 micro and a 74LS595 shift register.  The controller was made by Advanced Circuits here in colorado and came in today after about ~5 business days. I have to say it is probally my best board ever, guess all this practice is paying off.  I did make a few mistakes, including routing the nixie board connector backwards, which means some hacked connector pins. Good decisions PCBs come from experience, experience come from making bad decisions PCBs.

Controller schematic

Daughter boards (I forgot to add 5V to the connector, so that is a blue wire)

Robust C Code Part 1 – C Preprocessor

For years I tried to write C code for microcontrollers that was robust, modular, and reusable with limited success.  It always seemed that there was some requirement that caused a module to become dedicated to a specific piece of hardware or switching to another processor caused hours of reworking register bits.  Over the last few years I was exposed to some really cool ways to make C code more robust and flexible which allows code reuse and reduces fat-finger errors of setting the wrong bits.  I wanted to create a series of posts on this and one of the first places to start is using the C preprocessor to make accessing hardware more user friendly.

Microcontroller development differs from operating system development in C in many ways, one of which is accessing hardware directly from the C language. Each microcontroller has special hardware that interfaces with the real world, for example a general purpose IO pin is used to interact with the real world using logic signals (high and low). Accessing the port pins differs wildly from processor to processor, to access the PortA pin 1 of a Microchip PIC24 chip in C would look something like this:

// Make PortA pin 1 an output
TRISAbits.TRISA1 = 0;
// Make PortA pin 1 a high value
LATAbits.LATA1 = 1;

This can look a little confusing to some, it would be much easier if there was a function that the developer could call, for example pin_output(porta,1), which would do this for you.  Now you could make a function that does that, however since microcontrollers usually have limited FLASH and RAM, making functions for each register and bit can get out of hand quickly.  The solution is the C preprocessor. The preprocessor uses ‘directives‘ which are like instructions that get run before the compiler. Some directive examples are #define, #include, and #pragma. The #define directive replaces sequences of text in C sources.  If you have ever wrote basic C the following macro will look familiar:

#define DAYS_IN_A_YEAR    365

The C preprocessor searches for the sequence of characters DAYS_IN_A_YEAR in the C source and replaces it with the numbers 365.  No checking is done, so having “#define bit 44” would replace the characters ‘bit’ with 44, which can result in the previous example turning into:

// Make PortA pin 1 an output
TRISA44s.TRISA1 = 0;
// Make PortA pin 1 a high value
LATA44s.LATA1 = 1;

Since there is no TRIS44 register in the PIC24, this won’t compile.  However you can use the direct replacement of the preprocessor to make setting bits very easy to remember and look like functions.  Take the following preprocessor #define directive for example

#define days_in_a_year()    (365)

This replaces days_in_a year() with the characters (365).  This is called a macro. Now you can have some C code that does the following

int x;
x = days_in_a_year();

days_in_a_year() is a macro, not a function, it looks like one, but when the C preprocessor runs you get the following:

int x;
x = (365);

No function code is developed and the code will (most likely) compile to a single instruction or two, to move the value 365 into the variable x. The same ‘function’ trick can be done with the port pin assignment mentioned above.  Take a look at these preprocessor directives

// PIC24 PortA pin 1 register macros
#define porta_pin_1_output()               (TRISAbits.TRISA1 = 0)
#define porta_pin_1_input()                (TRISAbits.TRISA1 = 1)
#define porta_pin_1_high()                 (LATAbits.LATA1 = 1)
#define porta_pin_1_low()                   (LATAbits.LATA1 = 0)

// Make PortA pin 1 an output
porta_pin_1_output();
// Make PortA pin 1 a high value
porta_pin_1_high();

If you put the directives in a header file and include it in your code, you will never have to set a bit register again.  Also, if you move processors, lets say to an Atmel Atmega, you can change the preprocessor directives and all the code is changed automatically:

// Atmel Atmega PortA pin 1 register macros
#define porta_pin_1_output()               (DDRA.1 = 1)
#define porta_pin_1_input()                (DDRA.1 = 0)
#define porta_pin_1_high()                 (PORTA.1 = 1)
#define porta_pin_1_low()                   (PORTA.1 = 0)

// Make PortA pin 1 an output
porta_pin_1_output();
// Make PortA pin 1 a high value
porta_pin_1_high();

That’s it for this post, there is MUCH more you can do with C and the preprocessor, so check back for some more posts in the series.

WordPress Themes