Skip to content
View in the app

A better way to browse. Learn more.

Komuniti @PuTeRA

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Apa Beza C++ Dengan Assambly Language

Featured Replies

kawan2 ,, aku nak blaja untuk program pic,, tp aku xtau nak bezakan c, c++ atau assambly language,, korg blh terangkan x ,,pls konfius ni
C/C++ ni high level language
Assembly low level language..

high level ni maknanya, code dia tu bile kita baca..kita bleh paham dengan mudah sebab dia mostly 'english like' language..
low level ni bahasa code dia tu sukar nak paham sebab dia bukan macam 'english like'.

contoh c/c++
[code]
#include <pic16f87.h>
__CONFIG(0x3733);

TRISA = 0xFF;
TRISB = 0x00;


void main(void)
{
while(1){
if(RA1==0){
RB2=1;
}else{
RB2=0;
}
}
}
[/code]
kalau baca code di atas, ko bleh paham kan dengan mudah ape operation dia?cuba ko baca yang bawah ni lak..senang tak nak paham

[code]

#include p16F877.inc
__config _HS_OSC & _WDT_OFF & _LVP_OFF & _PWRTE_ON

ORG 0

RESET
nop
goto START

ORG 4

START
bsf STATUS,RP0
movlw b'11111111'
movwf TRISA
movlw b'00000000'
movwf TRISB
bcf STATUS,RP0

MAIN
movf PORTA,W
movwf PORTB
goto MAIN
end
[/code]
  • Author
aku beginnner lg,, ape perkara wajib sblom tulis aturcara......

#include <pic16f87.h>
__CONFIG(0x3733);
include file tu adalah setting untuk microcontroller/microprocessor yang ko guna..macam bit assignment, port assignment address..timer setting, prescaller, dan macam2 setting lagi..
ini untuk memudahkan programmer utk buat coding tanpa perlu merujuk kepada datasheet microcontroller dengan terperinci..

__CONFIG(0x3732)

ni biasanya configuration utk uController yang ko gune..macam nak enablekan watchdog timer ke..dan lain2 lagi..sila refer dengan datasheet utk maklumat lanjut..

dalam C, benda wajib..
include header file (jika ada)
mesti ada function main() <- ni adalah entry point program ko
lain-lain configuration tu optional..kalau ko tak set ape2..maknanya dia akan guna default settings...
selalunya aku akan set ikut spec program dan hardware yang aku nak..
  • Author
wah,, ko bleh jadi guru aku x,, aku takde org yg blh ajo aku ar,,,
data sheet tu kite kene rujuk pd datasheet pic yg kite gune la,, contoh pic16f84a
aku xdela pandai sangat pic ni..lama jgak la aku tinggal pic ni..pic16f84 ni time diploma dulu ada la buat fyp..time degree blaja pic16f877a..time practical blaja pic18f845a..tapi basic dia sama je..bagus la kalo ko start dengan pic16f84a..dia tak complicated sangat dan tak banyak sangat i/o port..nak bantu sket2 tu bleh la..
  • Author
ape sofware yg sesuai tuk aku buat aturcara,,, kalau aku guna pic basic pro punye software ok x??
PIC Basic Pro gune language BASIC..dan ko kena beli program tu..better ko gune MPLab yang dikeluarkan oleh Microchip..boleh download secara percuma dari website diorang..MPLab ni IDE yang ada editor dan compiler..

language dia C, nak inline assembly pun boleh...
aku cadang ko gi kat cytron.com.my..diorang banyak buat starter kit untuk new programmer..pastu dia ada contoh2 program..ada technical assistant gak..ade demo..
  • 3 weeks later...
bila taip code c/c++ utk pic, then ms nak build or masukkan program dlm pic tu, compiler akan convert balik coding c/c++ tu kpd assembler language. pk2 balik elok direct wat coding pakai assembly language terus jah lg best.
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.