Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

Archive for November, 2008

3M Four Wall Header

Posted by Circuit Negma on November 20, 2008


Created By: Hussein Nosair

3M 10 pins Header:

3M 16 pins Header:

Advertisements

Posted in Electronics | Leave a Comment »

HC12 Microcontroller :: Assembly vs. C syntax

Posted by Circuit Negma on November 19, 2008


Created By: Hussein Nosair

Source: EE308 @ New Mexico Tech

Comparison of basic assembly language and C syntax

Assembly                      |   C
------------------------------|------------------------------------
; Use a name instead of a num |   /* Use a name instead of a num */
COUNT:  EQU  5                |   #define COUNT 5
;-----------------------------|   /*-----------------------------*/
;start a program              |   /* To start a program */
CODE:  section  .text         |   main()
       org   $0800            |   {
       lds   #$0A00           |   }
;-----------------------------|   /*-----------------------------*/
;allocate two bytes for       |   /* Allocate two bytes for 
;a signed number              |    * a signed number */
                              |
DATA: section .data           |
      org     $0900           |
i:    ds.w    1               |   int i;
j:    dc.w    $1A00           |   int j = 0x1a00;
;-----------------------------|   /*-----------------------------*/
;allocate two bytes for       |   /* Allocate two bytes for 
;an unsigned number           |    * an unsigned number */
i:    ds.w    1               |   unsigned int i;
j     dc.w    $1A00           |   unsigned int j = 0x1a00;
;-----------------------------|   /*-----------------------------*/
;allocate one byte for        |   /* Allocate one byte for 
;an signed number             |    * an signed number */
                              |
i:    ds.b    1               |   signed char i;
j:    dc.b    $1F             |   signed char j = 0x1f;
;-----------------------------|   /*-----------------------------*/
;Get a value from an address  |   /* Get a value from an address */
                              |
i:  ds.b   1                  |   unsigned char i;
                              |
    ldx    $E000              |   i = *(unsigned char *) 0xE000;
    ldaa   0,x                |  
    staa   i                  |
;-----------------------------|   /*-----------------------------*/
; Use a variable to store     |   /* Use a variable as a pointer
; an address                  |      (address) */
                              |  
i:   ds.b  1                  |   unsigned char *ptr, i;  
ptr: ds.b  1                  |  
                              |  
     ldd   #$E000             |   ptr = (unsigned char *) 0xE000;
     std   ptr                |   
     ldx   ptr                |   i = *ptr;  
     ldaa  0,x                |  
     staa  i                  |   
     ldx   ptr                |   *ptr = 0x55;
     ldaa  #$55               |  
     staa  0,x                |   
;-----------------------------|   /*-----------------------------*/
;To call a subroutine         |   /* To call a function */
  ldaa  i                     |   sqrt(i);
  jsr   sqrt                  |
;-----------------------------|   /*-----------------------------*/
;To return from a subroutine  |   /* To return from a function */
  ldaa  j                     |   return j;
  rts                         |

;-----------------------------|   /*-----------------------------*/
;Flow control                 |   /* Flow control */
    blo                       |   if (i < j)
    blt                       |   if (i < j)
                              |
    bhs                       |   if (i >= j)
    bge                       |   if (i >= j)
                              |

Posted in C Programming, Electronics | Leave a Comment »

PC/104 Connector Pin Assignment and Layout

Posted by Circuit Negma on November 5, 2008


Created by:Hussein Nosair

Row B Row A Row C Row D
Pin No. Signal Pin No. Signal Pin No. Signal Pin No. Signal
1 GND 33 IOCHCK 65 GND 85 GND
2 RSTDRV 34 D7 66 SBHE 86 MEMCS16
3 +5V 35 D6 67 LA23 87 IOCS16
4 IRQ9 36 D5 68 LA22 88 IRQ
5 -5V 37 D4 69 LA21 89 IRQ
6 DRQ2 38 D3 70 LA20 90 IRQ
7 -12V 39 D2 71 LA19 91 IRQ
8 ENDXFER 40 D1 72 LA18 92 IRQ
9 +12V 41 D0 73 LA17 93 DACK
10 KEY 42 IOCHRDY 74 MEMR 94 DRQ
11 SMEMW 43 AEN 75 MEMW 95 DACK
12 SMEMR 44 A19 76 SD8 96 DRQ
13 IOW 45 A18 77 SD9 97 DACK
14 IOR 46 A17 78 SD10 98 DRQ
15 DACK3 47 A16 79 SD11 99 DACK
16 DRQ3 48 A15 80 SD12 100 DRQ
17 DACK1 49 A14 81 SD13 101 +5V
18 DRQ1 50 A13 82 SD14 102 MASTER
19 REFRESH 51 A12 83 SD15 103 GND
20 SYSCLK 52 A11 84 GND 104 GND
21 IRQ7 53 A10
22 IRQ6 54 A9
23 IRQ5 55 A8
24 IRQ4 56 A7
25 IRQ3 57 A6
26 DACK2 58 A5
27 TC 59 A4
28 BALE 60 A3
29 +5V 61 A2
30 OSC 62 A10
31 GND 63 A0
32 GND 64 GND

Posted in Electronics | Leave a Comment »