Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

What does these instruction means in Basic language?

Status
Not open for further replies.

perpetual_dream

New Member
Hey,
I found a program for recieving rs-232 serial data. The program is written in basic which i have 0 knowledge in but Ive been able to understand most of it. Anyway, I couldnt understand these instructions....
org 8
delay_cntr ds 1 ; counter for serial delay routines
bit_cntr ds 1 ; number of received bits
rcv_byte ds 1 ; the received byte
what does these instructions mean + what does movb mean?
This program has been used on pic16c54 can i use on pic 16f628?
Thanks a lot :)
 
perpetual_dream said:
Hey,
I found a program for recieving rs-232 serial data. The program is written in basic which i have 0 knowledge in but Ive been able to understand most of it. Anyway, I couldnt understand these instructions....
org 8
delay_cntr ds 1 ; counter for serial delay routines
bit_cntr ds 1 ; number of received bits
rcv_byte ds 1 ; the received byte
what does these instructions mean + what does movb mean?
This program has been used on pic16c54 can i use on pic 16f628?
Thanks a lot :)

That doesn't look anything like BASIC?.

Try my tutorials, which give assembler RS232 routines for the 16F628 (or any 14 bit PIC - or 12 bit for that matter).
 
bit_K = 24 ; Change this value for desired
; baud rate as shown in table.
half_bit = bit_K/2
serial_in = ra.2
data_out = rb
; Variable storage above special-purpose registers.
org 8
delay_cntr ds 1 ; counter for serial delay routines
bit_cntr ds 1 ; number of received bits
rcv_byte ds 1 ; the received byte
; Org 0 sets ROM origin to beginning for program.
org 0
; Remember to change device info if programming a different PIC. Do not use RC
; devices. They are not sufficiently accurate or stable for serial communication.
device pic16c54,xt_osc,wdt_off,protect_off
reset begin
; Set up I/O ports.
begin mov !ra, #00000100b ; Use RA.2 for serial input.
mov !rb, #0 ; Output to LEDs.
:start_bit snb serial_in ; Detect start bit. Change to sb
; serial_in if using 22k resistor
; input.
jmp :start_bit ; No start bit yet? Keep watching.
call start_delay ; Wait one-half bit time to the
; middle of the start bit.
jb Serial_in, :start_bit ; If the start bit is still good,
; continue. Otherwise, resume
; waiting.
; Change to jnb Serial_in,
:start_bit
; if using 22k resistor input.
mov bit_cntr, #8 ; Set the counter to receive 8 data
; bits.
clr rcv_byte ; Clear the receive byte to get
; ready for new data.
:receive call bit_delay ; Wait one bit time.
movb c,Serial_in ; Put the data bit into carry.
; Change to movb c,/Serial_in if
; using 22k resistor input.
rr rcv_byte ; Rotate the carry bit into the
; receive byte.
djnz bit_cntr,:receive ; Not eight bits yet? Get next bit.
call bit_delay ; Wait for stop bit.
mov data_out, rcv_byte ; Display data on LEDs.
goto begin:start_bit ; Receive next byte.

here is the complete program if it helps :)
Ill check out ur tutorials too :)
 
looks more like assembler or some sort of convoluted hybrid, deffinately not basic with commands like ORG, MOVB, MOV, JMP

the compiler I work with lets me mix basic and assembler interchangably, perhaps that is what you're seeing too?
 
That looks like the ancient, and obscure, parallax assembler - that Papabravo apparently still uses? - although he doesn't appear to post code for any of his 'projects', so I can't be sure?.

Presumably it's from the similarily ancient Parallax application note?, as I said before CHECK MY TUTORIALS! - which use the same serial routines but rewritten to use the proper MicroChip assembler.
 
Hi,
I checked ur tutorial on how to do rs-232. Ive tried to build the project in MPLAB and got the following error
PLINK 4.02, Linker
Copyright (c) 2006 Microchip Technology Inc.
Error - section '.config' type is non-overlay and absolute but occurs in more than one input file.
Errors : 1

It's my first project in MPLAB. I checked the tutorial I added the following files:
Header files : PIC16F628
Linker scripts: 16f628.lkr
source files: f628tmp.asm + tut 7_5.asm
this how my work space looks like:
thnx for ur continous help
 

Attachments

  • pic_rs232.JPG
    pic_rs232.JPG
    59.4 KB · Views: 236
In defense of Papabravo, ie:
That looks like the ancient, and obscure, parallax assembler - that Papabravo apparently still uses? - although he doesn't appear to post code for any of his 'projects', so I can't be sure?.
It isn't him who uses that crap, it is William (at his blue room.)

Regards,
Robert
 
perpetual_dream,
I think you have to get rid of the linker file. Isn't your code done in absolute, rather than relocatable mode?
Error - section '.config' type is non-overlay and absolute but occurs in more than one input file.

Regards,
Robert
 
No, it gives me an error whenever i remove the linker file.... it can't be compiled... It's my first project in MPLAB as I said I don't know how stuff goes... but I read the tutorial and it says it needs the source header and linker files.....
THNX
 
BeeBop said:
In defense of Papabravo, ie:

It isn't him who uses that crap, it is William (at his blue room.)

Apologies to Papabravo, I was just going from memory, fuelled by alcohol :D

As for the code, it can easily be assembled using the assembler MPASM, which is installed along with MPLAB - and which is presumably called by MPLAB to do the actual assembly anyway?.
 
Nigel, I'm shocked! :) lol!

perpetual_dream,
I just downloaded the tutorial, created a project in MP Lab, and assembled it. I didn't use a linker file, and the project assembled on the first try. How did you create your project? Over.
Regards,
Robert
 
BeeBop said:
Nigel, I'm shocked! :) lol!

perpetual_dream,
I just downloaded the tutorial, created a project in MP Lab, and assembled it. I didn't use a linker file, and the project assembled on the first try. How did you create your project? Over.

I write the source using a text editor, and save it to hard-disk with a .ASM file name. I then run MPASMWIN and load the .ASM file, click on 'Assemble' and it produces a .HEX file I then load into WinPicProg. By selecting a 'tick box' on WinPicProg the last operation becomes automatic after the first time, once the new .HEX file appears WinPicProg detects it, loads it, and blows the PIC.

I've NEVER used MPLAB, nor seen any reason to? - but I come from the days when all MicroChip tools were DOS only!.
 
OK... I know Ive asked two many question... I've done the following...
I ran MPASM... I Loaded the file... I checked the HEX radio button and I chose the list and object files as the generated files and pic16f628 as the processor and clicked on assemble....
I am left with the generated files in the attached image.... object file and a list file...
I went to winpicprog and tried to open the object file but it just can't detect... I'm lost somehow... what am supposed to do 2load the code in the microcontroller !
THNX a lot nigel... I really really appreciate ur help
 

Attachments

  • MPASM.JPG
    MPASM.JPG
    128.6 KB · Views: 289
  • generated files.JPG
    generated files.JPG
    67.2 KB · Views: 143
perpetual_dream said:
OK... I know Ive asked two many question... I've done the following...
I ran MPASM... I Loaded the file... I checked the HEX radio button and I chose the list and object files as the generated files and pic16f628 as the processor and clicked on assemble....
I am left with the generated files in the attached image.... object file and a list file...
I went to winpicprog and tried to open the object file but it just can't detect... I'm lost somehow... what am supposed to do 2load the code in the microcontroller !
THNX a lot nigel... I really really appreciate ur help

I don't have 'Object File' ticked on mine, the file you're looking to load in WinPicProg ends in .HEX
 
Ok... I was able to generate a HEX file using the quick load optioon in MPLAB. I have a HEX file. What is the benefit winpicprog?. I loaded the file and it says Warning fuses not set in loaded file.
 
Status
Not open for further replies.

Latest threads

Back
Top