Lost Password?

Go Back   CodeCall Programming Forum > Software Development > General Programming

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-16-2007, 04:27 AM
emaney emaney is offline
Newbie
 
Join Date: Jun 2007
Posts: 1
Credits: 0
Rep Power: 0
emaney is on a distinguished road
Default assembly code help

The following code does this
;question
;A de-multiplexer has an input line, pinRB0, and four output
;lines, output0 to output3, which are, respectively, the pins RA0-RA3. the
;demultiplexer copies the digital signal appearing on the input line on to one of
;the four output lines. The output line is selected by a two bit
;selection code input on the pins RB1 and RB2.

PLEASE LOOK AT THE CODE BECAUSE ITS NOT EXACTLY DOING WHA IT IS MENTIONED ABOVE ANYONE CAN HELP ME FIX THIS..............PLEASE

Code:
#DEFINE PAGE0 BCF 0x03,5
#DEFINE PAGE1 BSF 0x03,5

PCL: EQU 0x02
STATUS: EQU 0x03
PORTA: EQU 0x05
TRISA: EQU 0x05
PORTB: EQU 0x06
TRISB: EQU 0x06

W: EQU 0
F: EQU 1

ORG 0x0
goto MAIN
org 5

MAIN:
clrf PORTA
clrf PORTNB
PAGE1
movlw B'00000111'
iorwf TRISA,F ;RA0-RA2 as input
clrf TRISB ;Port B0-B7 as output
PAGE0
loop:

  ;get the output selector
  movf PORTB,w
  rrf WREG
  andlw B'00000011'

  ;convert 0-3 to bit-mask
  call table
  movwf Mask

  ;switch all zeroes to ones in mask and vice versa
  xorlw B'11111111',w

  ;read all the bits of PORTA but the selected one (leave it clear)
  andwf PORTA,w

  ;if PORTB.0 is set, set also selected output in PORTA
  btfsc PORTB,0
  xorwf Mask,w

  ;write modified value back to PORTA
  movwf PORTA
  goto loop  

table:

  addwf PCL,F
  retlw B'00000001'
  retlw B'00000010'
  retlw B'00000100'
  retlw B'00001000'

Last edited by v0id; 06-16-2007 at 06:27 AM. Reason: Added code-tags.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Assembly Tutorials Jordan General Programming 39 10-05-2008 04:40 PM
Contest: C# vs. Java vs. Visual Basic Jordan General Programming 250 10-05-2008 02:47 PM
Basic Calculator AfTriX VB Tutorials 3 02-29-2008 08:53 AM
Where to Put PHP Code clookid PHP Tutorials 1 01-11-2007 08:44 PM


All times are GMT -5. The time now is 05:08 AM.

Contest Stats

Xav ........ 1024.41
MeTh0Dz|Reb0rn ........ 974.08
morefood2001 ........ 850.04
John ........ 841.93
WingedPanther ........ 661.52
marwex89 ........ 575.59
Brandon W ........ 456.18
chili5 ........ 292.12
orjan ........ 187.41
Steve.L ........ 181.88

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 79%

Ads