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.

Urgent HELP basic PIC asm programing

Status
Not open for further replies.
Nigel Goodwin said:
But NOT with a PIC, it's completely pointless - the PIC already has ROM and RAM inside it, and has no access to it's own program memory (for most PIC's) so can't even run externally stored code!.
well.. i feel ..this is not a project ..but an exercise , "to transfer 10 bytes from an external ram and store it in the internal ram " (not program memory).
Nicoara , a suggestion. can u use i2c ram/rom modules . if yes the problem is simplified very much . and even without i2c u can use the ports for address and datalines for the external ram.
 
Without the decoder chip the circuit will actually work and you could read/write ram and read ROM. Assuming the decoder is a 138 - 3 to 8 decoder then you can read/write every n*8 th byte from ram and every n*8+7 th byte from ROM. Very weird. If you get rid of the decoder and tie the /CE pins low (I assume /ES = strobe enable = address latch) then everything will work.

As Nigel has already stated, this is nonsense with a pic chip. However, having seen some of the stuff my kids are being taught, you get my sympathy vote. If you designed the circuit then go back to the beginning and start again.

If you still need code to read/write the various bits then I will bodge something together tomorrow.

Mike.
 
akg said:
well.. i feel ..this is not a project ..but an exercise , "to transfer 10 bytes from an external ram and store it in the internal ram " (not program memory).

Obviously not a project, because it's pointless, but even as an exercise it's completely pointless and stupid - it can only be set by someone completely clueless about PIC's and their architecture (Harvard, and not Von Neumann).

As the useless diagram was provided, presumably the exercise has to use that? - rather than something which might be slightly useful?.
 
<slightly off topic>

Perhaps not entirely nonsense. Just a couple days ago I thought about adding a small 'wide' PORTB driven EEPROM to a PIC circuit as a method for driving an 8-bit R2R ladder to improve DDS loop time from 1.2-usec to 800-nsec.

Mike
 
Mike said:
<slightly off topic>

Perhaps not entirely nonsense. Just a couple days ago I thought about adding a small 'wide' PORTB driven EEPROM to a PIC circuit as a method for driving an 8-bit R2R ladder to improve DDS loop time from 1.2-usec to 800-nsec.

And did you consider doing it in 1970's micro-processor fashion?, I don't think so :D

As a learning exercise for students it's teaching them nothing, except how NOT to design a circuit!.

Anyway, I'm intrigued now! - how would your EEPROM improve the speed?, do you mean by using it as an external look-up table?, rather than an internal one?.
 
Nigel Goodwin said:
And did you consider doing it in 1970's micro-processor fashion?, I don't think so :D
No, not at all. I was simply going to drive the 8 low order EEPROM address bits from PORTB.
As a learning exercise for students it's teaching them nothing, except how NOT to design a circuit!.
I'm curious too. Unless the object of the lesson is to teach them how to work with multiplexed address/data lines?
Anyway, I'm intrigued now! - how would your EEPROM improve the speed?, do you mean by using it as an external look-up table?, rather than an internal one?.
Yes, that's exactly correct. The EEPROM would contain the 256 step Sine, Triangle, Sawtooth, and Square R2R tables. Port B would actually be the most significant 8 bits of the 24-bit phase accumulator.

Code:
;
;  TEST1 uses internal lookup table and R2R ladder on Port B
;
;  10-step freq limit 83-KHz, resolution approx 0.05-Hz
;
TEST1
        movf    ADDERL,W        ; adder L  (1) (100-nsecs)
        addwf   ACCUML,f        ; accum L  (1)
        movf    ADDERH,W        ; adder H  (1)
        addwfc  ACCUMH,f        ; accum H  (1)
        movf    ADDERU,W        ; adder U  (1)
        addwfc  TBLPTRL,f       ; accum U  (1)
        tblrd   *               ;          (2)
        movf    TABLAT,W        ;          (1)
        movwf   LATB            ;          (1)
        bra     TEST1           ;          (2) (1.2-usec loop)
;
;  TEST2 uses external EEPROM table and R2R ladder on EEPROM
;  output, Port B drives EEPROM address lines A0..A7 with A8
;  and A9 address lines used to select the 256-byte/256 step
;  Sine, Square, Triangle, or Sawtooth EEPROM tables
;
;  10-step freq limit 124-KHz, resolution approx 0.07-Hz
;
TEST2
        movf    ADDERL,W        ; adder L  (1) (100-nsecs)
        addwf   ACCUML,f        ; accum L  (1)
        movf    ADDERH,W        ; adder H  (1)
        addwfc  ACCUMH,f        ; accum H  (1)
        movf    ADDERU,W        ; adder U  (1)
        addwfc  LATB,f          ; accum U  (1)
        bra     TEST2           ;          (2) (0.8-usec loop)
;
 
Last edited:
Has to be to teach address decoding or maybe the PIC EEPROM is not big enough for the table they need. I can not see it being faster?

But that does look like a diagram from 1970's missing a microprocessor. :)

I had to look twice.
 
I now have my eldest at uni and 2 others in high school. The stuff they are expected to learn is incredulous. They get questions like "is a disk drive a serial or parallel device?"

We can all see what is wrong with the posted circuit and the frivolity of the task set. However, this is how our (the world) education system appears to be going. My middle child is doing chemistry as one of her subjects, it appears she will be taught the history of chemistry :mad: :mad: :mad: If she wanted to do history she would have chosen it. She wanted to do Chemistry. Last week I ordered some test tubes and flasks.

Mike.
 
Mike said:
I'm curious too. Unless the object of the lesson is to teach them how to work with multiplexed address/data lines?

Except you wouldn't pick a PIC (pun intended!) to do it, you would choose a processor which requires external memory. Considering the other processors he mentioned, I suspect the teacher has simply copied the previous exercises, without any regard to their validity?.

Yes, that's exactly correct. The EEPROM would contain the 256 step Sine, Triangle, Sawtooth, and Square R2R tables. Port B would actually be the most significant 8 bits of the 24-bit phase accumulator.

Presumably you select which table to use by another couple of bits?, as you say it saves a few important nS - a sneaky little technique ;) Of course this was the old hardware way of doing it, using CMOS or TTL counters driving an EPROM, but it's just as valid with a micro, if you're wanting the best possible speed.
 
Nigel Goodwin said:
Except you wouldn't pick a PIC (pun intended!) to do it, you would choose a processor which requires external memory. Considering the other processors he mentioned, I suspect the teacher has simply copied the previous exercises, without any regard to their validity?.
You're right. The old 68HC11 F1 was very nice in this regard with built in address multiplexing and strobe signal decoding.

Presumably you select which table to use by another couple of bits?, as you say it saves a few important nS - a sneaky little technique ;)
Again, you're exactly correct. Port B drives one of the 256 byte / 256 step tables using A0..A7 address lines and A8-A9 select which table to use.

Sorry for the <off topic> posts guys. Regards, Mike
 
Why would you use external rom with a microcontroller? The point is that they are self contained. They have few pins. If you tie up 8+ pins you have lost half of the chip. If you need a look up table get a chip with more memory. I cannot see any reason to use external (parallel) rom with a pic chip.

And, yes, it is of topic.

Mike.
P.S. If you reply start a new thread.
 
Well all of you that replay to my topic i give my 10X !
1. The problem is just for learning , my teacher made it up to test our skills with PIC-s
2. The problem is now solved , i discussed with my teacher and he agreed with the conclusion that the design is pointless!
3. This topic can be closed now . thanks to everyone !

PS: If i'll ever need advice on microcontrollers problems (and i will because the profil of my university) i will come again ;)
 
Last edited:
Would be easier if he gave out a pic with an internal OSC, and said write a program to do 1HZ on port.0, 1Khz on port.1, 3.58Khz on port.2, debounce a switch on port.4, etc. And maybe I2C on a pin.. But glad you are off the hook.

Or put the original microprocessor back in and use the same assignment.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top