Any chance of Life being easy?


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Not quite as pretty as your verilog versions ... but should work

    ;Datum[6:4] = 2
    Datum.6=1
    Datum.4=0

    ;IF PORTB[5:1] = 3 THEN
    If (PORTB & $22) = $22 THEN

    EDIT:
    or
    Code:
    IF PORTB.5 = 1 THEN
      IF PORTB.1 = 1 THEN
      ENDIF
    ENDIF
    Last edited by paul borgmeier; - 2nd November 2006 at 04:47.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  2. #2
    josegamez's Avatar
    josegamez Guest


    Did you find this post helpful? Yes | No

    Smile Thanks

    Ok I see your point, although those aren't quite equivalent yet. A verilog statement like Datum[6:4] = 2 would change all bits from bit 6 to bit 4 of Datum, turning Datum into X010XXXX where the X's are the previous bit values of Datum before the statement. So referring to Datum as Datum[6:4] is like having a new 3 bit variable where Datum[4] is the new bit 0, Datum[5] is the new bit 1 and Datum[6] is the new bit 2 to complete the three bit variable. But thanks I guess I'll have to work my way around with those sort of tricks. Thanks for your time, God bless.

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    As is clear from above, I have never used verilog ...., for completeness this not so pretty approach still works

    Code:
    ;Datum[6:4] = 2
    Datum.6=0
    Datum.5=1
    Datum.4=0
    Code:
    ;IF PORTB[5:1] = 3 THEN
    If (PORTB & $3E) = $06 THEN
    OR you could blast the first type with inline ASM

    Code:
    ;Datum[6:4] = 2
    Datum var byte
    ASM
       movlw	0x20          ; b00100000 new values
       xorwf 	_Datum, W  
       andlw 	0x70          ; b01110000 mask values
       xorwf 	_Datum, F     ; bX010XXXX
    ENDASM
    Others might have a cleaner method?

    EDIT - added comments to ASM routine
    Last edited by paul borgmeier; - 2nd November 2006 at 20:41.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  4. #4
    josegamez's Avatar
    josegamez Guest


    Did you find this post helpful? Yes | No

    Thumbs up Ok

    OK thanks a lot, I'll try that

Similar Threads

  1. Easy and Accurate Clocks without RTC IC
    By paul borgmeier in forum Code Examples
    Replies: 18
    Last Post: - 28th October 2013, 21:28
  2. Transceiver ER900TRS Easy Radio
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th August 2008, 11:25
  3. Super easy 18F print strings to UART
    By Bruce in forum Code Examples
    Replies: 0
    Last Post: - 26th August 2007, 23:19
  4. EEPROM life expectancy?
    By muddy0409 in forum General
    Replies: 3
    Last Post: - 1st May 2007, 12:44
  5. Easy LCD BackLight
    By Melanie in forum Schematics
    Replies: 0
    Last Post: - 17th October 2004, 13:18

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts